Browse Source

add possibility to run tf from branch (#1297)

Co-authored-by: Azat Safin <azsafin@provectus.com>
azatsafin 3 years ago
parent
commit
317d956c3c
1 changed files with 8 additions and 8 deletions
  1. 8 8
      .github/workflows/terraform-deploy.yml

+ 8 - 8
.github/workflows/terraform-deploy.yml

@@ -3,9 +3,13 @@ on:
   workflow_dispatch:
     inputs:
       applyTerraform:
-        description: 'Do you want to apply the infra-repo terraform? Possible values [yes/no]. If no is chosen only plan will be executed. If yes is chosen, terraform will be automatically applied.'
+        description: 'Do you want to apply the infra-repo terraform? Possible values [plan/apply].'
         required: true
-        default: 'no'
+        default: 'plan'
+      KafkaUIInfraBranch:
+        description: 'Branch name of Kafka-UI-Infra repo, tf will be executed from this branch'
+        required: true
+        default: 'master'
 
 jobs:
   terraform:
@@ -15,7 +19,7 @@ jobs:
       - name: Clone infra repo
         run: |
           echo "Cloning repo..."
-          git clone https://kafka-ui-infra:${{ secrets.KAFKA_UI_INFRA_TOKEN }}@gitlab.provectus.com/provectus-internals/kafka-ui-infra.git --branch master
+          git clone https://kafka-ui-infra:${{ secrets.KAFKA_UI_INFRA_TOKEN }}@gitlab.provectus.com/provectus-internals/kafka-ui-infra.git --branch ${{ github.event.inputs.KafkaUIInfraBranch }}
           echo "Cd to deployment..."
           cd kafka-ui-infra/aws-infrastructure4eks/deployment
           echo "TF_DIR=$(pwd)" >> $GITHUB_ENV
@@ -51,13 +55,9 @@ jobs:
           export TF_VAR_repo_user_key=${{ secrets.KAFKA_UI_INFRA_TOKEN }}
           terraform plan --var-file="../envs/pro/eks.tfvars"
 
-      - name: Terraform plan status
-        if: steps.plan.outcome == 'failure'
-        run: exit 1
-
       - name: Terraform apply
         id: apply
-        if: ${{ github.event.inputs.applyTerraform == 'yes' }}
+        if: ${{ github.event.inputs.applyTerraform == 'apply' }}
         run: |
           cd $TF_DIR
           export TF_VAR_github_connector_access_token=${{ secrets.SOURCE_CONNECTOR_GITHUB_TOKEN }}