Skip to content

Commit 2966d85

Browse files
authored
Fix terraform pipelines (#7)
* Fix terraform pipelines * Fix terraform auto-approve
1 parent 45b4bad commit 2966d85

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/main-terraform.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ jobs:
4444
role-session-name: ${{ inputs.role_session_name }}
4545
aws-region: ${{ inputs.aws_region }}
4646

47-
- name: Create Parameters file
48-
run: echo '${{ inputs.staging_tfvars_json }}' > staging.tfvars.json
47+
- name: Download Staging Variables
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: staging-variables
51+
path: ${{ inputs.working_directory }}
4952

5053
- name: Setup Terraform
5154
uses: hashicorp/setup-terraform@v2
@@ -58,7 +61,7 @@ jobs:
5861

5962
- name: Terraform Staging Apply
6063
id: apply-staging
61-
run: terraform apply -no-color -var-file=staging.tfvars.json
64+
run: terraform apply -auto-approve -input=false -var-file=staging.tfvars.json
6265
env:
6366
TF_WORKSPACE: staging
6467
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-terraform.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ jobs:
4444
role-session-name: ${{ inputs.role_session_name }}
4545
aws-region: ${{ inputs.aws_region }}
4646

47-
- name: Create Parameters file
48-
run: echo '${{ inputs.prod_tfvars_json }}' > prod.tfvars.json
47+
- name: Download Prod Variables
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: prod-variables
51+
path: ${{ inputs.working_directory }}
4952

5053
- name: Setup Terraform
5154
uses: hashicorp/setup-terraform@v2
@@ -58,7 +61,7 @@ jobs:
5861

5962
- name: Terraform Prod Apply
6063
id: apply-prod
61-
run: terraform apply -no-color -var-file=prod.tfvars.json
64+
run: terraform apply -auto-approve -input=false -var-file=prod.tfvars.json
6265
env:
6366
TF_WORKSPACE: prod
6467
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)