File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Tofu Apply
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ paths : ["td5/scripts/tofu/live/lambda-sample/**"]
7+
8+ jobs :
9+ apply :
10+ name : " Tofu Apply"
11+ runs-on : ubuntu-latest
12+ permissions :
13+ pull-requests : write
14+ id-token : write
15+ contents : read
16+
17+ steps :
18+ - name : Checkout repository
19+ uses : actions/checkout@v2
20+
21+ - name : Configure AWS credentials
22+ uses : aws-actions/configure-aws-credentials@v3
23+ with :
24+ role-to-assume : ${{ secrets.APPLY_ROLE_ARN }}
25+ role-session-name : apply-${{ github.run_number }}-${{ github.actor }}
26+ aws-region : us-east-2
27+
28+ - name : Setup OpenTofu
29+ uses : opentofu/setup-opentofu@v1
30+
31+ - name : Run tofu apply
32+ id : apply
33+ working-directory : td5/scripts/tofu/live/lambda-sample
34+ run : |
35+ tofu init -no-color -input=false
36+ tofu apply -no-color -input=false -lock-timeout=60m -auto-approve
37+
38+ - name : Find current PR
39+ uses : jwalton/gh-find-current-pr@master
40+ id : find_pr
41+ with :
42+ state : all
43+
44+ - name : Post apply output in PR comment
45+ uses : peter-evans/create-or-update-comment@v4
46+ if : steps.find_pr.outputs.number
47+ env :
48+ RESULT_EMOJI : ${{ steps.apply.outcome == 'success' && '✅' || '⚠ ' }}
49+ with :
50+ issue-number : ${{ steps.find_pr.outputs.number }}
51+ body : |
52+ ## ${{ env.RESULT_EMOJI }} `tofu apply` output
53+ ```${{ steps.apply.outputs.stdout }}```
Original file line number Diff line number Diff line change 1+ name : Tofu Plan
2+
3+ on :
4+ pull_request :
5+ branches : ["main"]
6+ paths : ["td5/scripts/tofu/live/lambda-sample/**"]
7+
8+ jobs :
9+ plan :
10+ name : " Tofu Plan"
11+ runs-on : ubuntu-latest
12+ permissions :
13+ pull-requests : write
14+ id-token : write
15+ contents : read
16+
17+ steps :
18+ - name : Checkout repository
19+ uses : actions/checkout@v2
20+
21+ - name : Configure AWS credentials
22+ uses : aws-actions/configure-aws-credentials@v3
23+ with :
24+ role-to-assume : ${{ secrets.PLAN_ROLE_ARN }}
25+ role-session-name : plan-${{ github.run_number }}-${{ github.actor }}
26+ aws-region : us-east-2
27+
28+ - name : Setup OpenTofu
29+ uses : opentofu/setup-opentofu@v1
30+
31+ - name : Run tofu plan
32+ id : plan
33+ working-directory : td5/scripts/tofu/live/lambda-sample
34+ run : |
35+ tofu init -no-color -input=false
36+ tofu plan -no-color -input=false -lock=false
37+
38+ - name : Post plan output in PR comment
39+ uses : peter-evans/create-or-update-comment@v4
40+ if : always()
41+ env :
42+ RESULT_EMOJI : ${{ steps.plan.outcome == 'success' && '✅' || '⚠ ' }}
43+ with :
44+ issue-number : ${{ github.event.pull_request.number }}
45+ body : |
46+ ## ${{ env.RESULT_EMOJI }} `tofu plan` output
47+ ```${{ steps.plan.outputs.stdout }}```
You can’t perform that action at this time.
0 commit comments