File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 5252 # 4. Terraform Init (with backend config flags)
5353 - name : Terraform Init
5454 run : |
55- cd quest-gitops
55+ if [ -z "${{ secrets.TERRAFORM_STATE_BUCKET }}" ]; then
56+ echo "ERROR: TERRAFORM_STATE_BUCKET secret is not set. Set the secret in repo Settings -> Secrets and variables -> Actions." >&2
57+ exit 1
58+ fi
5659 terraform init \
5760 -backend-config="bucket=${{ secrets.TERRAFORM_STATE_BUCKET }}" \
5861 -backend-config="key=quest/terraform.tfstate" \
@@ -65,22 +68,19 @@ jobs:
6568 # 5. Terraform Validate
6669 - name : Terraform Validate
6770 run : |
68- cd quest-gitops
6971 terraform validate
7072 terraform fmt -check
7173 continue-on-error : true
7274
7375 # 6. Terraform Plan
7476 - name : Terraform Plan
7577 run : |
76- cd quest-gitops
7778 terraform plan -out=tfplan -var='manage_state_bucket=false'
7879 id : plan
7980
8081 # 7. Show Plan
8182 - name : Show Terraform Plan
8283 run : |
83- cd quest-gitops
8484 terraform show -json tfplan | jq '.resource_changes[] | select(.change.actions != ["no-op"])' | head -100
8585
8686 # 8. Comment Plan on PR (if PR)
@@ -112,7 +112,6 @@ jobs:
112112 (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
113113 (github.event_name == 'workflow_dispatch' && github.event.inputs.action == 'apply')
114114 run : |
115- cd quest-gitops
116115 terraform apply -auto-approve -input=false -var='manage_state_bucket=false' tfplan
117116 env :
118117 TF_INPUT : false
@@ -121,7 +120,6 @@ jobs:
121120 - name : Terraform Destroy
122121 if : github.event_name == 'workflow_dispatch' && github.event.inputs.action == 'destroy'
123122 run : |
124- cd quest-gitops
125123 terraform destroy -auto-approve -var='manage_state_bucket=false'
126124 env :
127125 TF_INPUT : false
@@ -130,6 +128,5 @@ jobs:
130128 - name : Get ALB DNS
131129 if : success()
132130 run : |
133- cd quest-gitops
134131 terraform output -json | jq '.alb_dns_name // empty' || echo "No ALB DNS available"
135132 continue-on-error : true
You can’t perform that action at this time.
0 commit comments