Skip to content

Commit 0db2baf

Browse files
committed
Move to tf-github-actions-role and add apply
1 parent bde3720 commit 0db2baf

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.github/workflows/github-actions-role-gf.yml renamed to .github/workflows/tf-github-actions-role.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,28 @@ name: github-actions-role tf
22

33
on:
44
push:
5+
#branches:
6+
# - main
57
pull_request:
68
paths:
7-
- .github/workflows/github-actions-role-gf.yml
9+
- .github/workflows/tf-github-actions-role.yml
810
- terraform/services/github-actions-role/**
9-
workflow_dispatch: # Allow manual trigger
11+
workflow_dispatch:
12+
inputs:
13+
apply:
14+
required: false
15+
type: boolean
1016

1117
jobs:
12-
check-terraform-fmt:
13-
runs-on: ubuntu-latest
18+
check-fmt:
19+
runs-on: codebuild-cdap-${{github.run_id}}-${{github.run_attempt}}
1420
steps:
1521
- uses: actions/checkout@v4
1622
- uses: ./actions/setup-tfenv-terraform
1723
- run: terraform fmt -check -diff -recursive terraform/services/github-actions-role
1824

19-
terraform-plan:
20-
needs: check-terraform-fmt
25+
plan-apply:
26+
needs: check-fmt
2127
permissions:
2228
contents: read
2329
id-token: write
@@ -43,8 +49,10 @@ jobs:
4349
role-to-assume: arn:aws:iam::${{ contains(fromJSON('["dev", "test"]'), matrix.env) && secrets.NON_PROD_ACCOUNT || secrets.PROD_ACCOUNT }}:role/delegatedadmin/developer/${{ matrix.app }}-${{ matrix.env }}-github-actions
4450
aws-region: ${{ vars.AWS_REGION }}
4551
- run: terraform init -backend-config=../../backends/${{ matrix.app }}-${{ matrix.env }}-gf.s3.tfbackend
46-
- run: terraform plan
52+
- run: terraform plan -out=tf.plan
4753
env:
4854
TF_VAR_app: ${{ matrix.app }}
4955
TF_VAR_env: ${{ matrix.env }}
5056
TF_VAR_legacy: "false"
57+
- run: terraform apply -auto-approve tf.plan
58+
if: ${{ inputs.apply == true }} || ${{ github.ref == "refs/heads/main" }}

0 commit comments

Comments
 (0)