add possibility to run tf from branch (#1297)
Co-authored-by: Azat Safin <azsafin@provectus.com>
This commit is contained in:
parent
223bf85b6b
commit
317d956c3c
1 changed files with 8 additions and 8 deletions
16
.github/workflows/terraform-deploy.yml
vendored
16
.github/workflows/terraform-deploy.yml
vendored
|
@ -3,9 +3,13 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
applyTerraform:
|
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
|
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:
|
jobs:
|
||||||
terraform:
|
terraform:
|
||||||
|
@ -15,7 +19,7 @@ jobs:
|
||||||
- name: Clone infra repo
|
- name: Clone infra repo
|
||||||
run: |
|
run: |
|
||||||
echo "Cloning repo..."
|
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..."
|
echo "Cd to deployment..."
|
||||||
cd kafka-ui-infra/aws-infrastructure4eks/deployment
|
cd kafka-ui-infra/aws-infrastructure4eks/deployment
|
||||||
echo "TF_DIR=$(pwd)" >> $GITHUB_ENV
|
echo "TF_DIR=$(pwd)" >> $GITHUB_ENV
|
||||||
|
@ -51,13 +55,9 @@ jobs:
|
||||||
export TF_VAR_repo_user_key=${{ secrets.KAFKA_UI_INFRA_TOKEN }}
|
export TF_VAR_repo_user_key=${{ secrets.KAFKA_UI_INFRA_TOKEN }}
|
||||||
terraform plan --var-file="../envs/pro/eks.tfvars"
|
terraform plan --var-file="../envs/pro/eks.tfvars"
|
||||||
|
|
||||||
- name: Terraform plan status
|
|
||||||
if: steps.plan.outcome == 'failure'
|
|
||||||
run: exit 1
|
|
||||||
|
|
||||||
- name: Terraform apply
|
- name: Terraform apply
|
||||||
id: apply
|
id: apply
|
||||||
if: ${{ github.event.inputs.applyTerraform == 'yes' }}
|
if: ${{ github.event.inputs.applyTerraform == 'apply' }}
|
||||||
run: |
|
run: |
|
||||||
cd $TF_DIR
|
cd $TF_DIR
|
||||||
export TF_VAR_github_connector_access_token=${{ secrets.SOURCE_CONNECTOR_GITHUB_TOKEN }}
|
export TF_VAR_github_connector_access_token=${{ secrets.SOURCE_CONNECTOR_GITHUB_TOKEN }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue