From 317d956c3c843b4cbd3d266b329a0cf417a083c7 Mon Sep 17 00:00:00 2001 From: azatsafin Date: Tue, 21 Dec 2021 12:12:39 +0300 Subject: [PATCH] add possibility to run tf from branch (#1297) Co-authored-by: Azat Safin --- .github/workflows/terraform-deploy.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/terraform-deploy.yml b/.github/workflows/terraform-deploy.yml index 666101f5eb..8eb2e7fcb0 100644 --- a/.github/workflows/terraform-deploy.yml +++ b/.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 }}