Skip to content

Commit 073e6f7

Browse files
committed
share tf plan in PR comment
1 parent d759efe commit 073e6f7

1 file changed

Lines changed: 92 additions & 87 deletions

File tree

.github/workflows/aws-iac-prs.yml

Lines changed: 92 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -7,97 +7,102 @@ permissions:
77
id-token: write
88
pull-requests: write
99
jobs:
10-
core_aws:
11-
outputs:
12-
plan: ${{ steps.plan_outcome.outputs.output }}
13-
fmt: ${{ steps.fmt_outcome.outputs.output }}
14-
defaults:
15-
run:
16-
working-directory: core-env/aws
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v3
20-
- name: Configure AWS Credentials
21-
uses: aws-actions/configure-aws-credentials@main # Or a specific version
22-
with:
23-
role-to-assume: arn:aws:iam::218691292270:role/sedemo-iac-pipeline-role
24-
aws-region: us-west-2
25-
- name: Verify AWS identity
26-
run: |
27-
# Your commands that require AWS credentials
28-
aws sts get-caller-identity
29-
- name: Verify Tofu
30-
uses: opentofu/setup-opentofu@v1
31-
- name: OpenTofu fmt
32-
id: fmt
33-
run: tofu fmt -check > /tmp/fmt.out
34-
continue-on-error: true
35-
- name: fmt output
36-
id: fmt_outcome
37-
run: echo "output=${{steps.fmt.outcome}}" >> "$GITHUB_OUTPUT"
38-
- run: tofu init
39-
- id: plan
40-
run: tofu plan -no-color > /tmp/plan.out
41-
continue-on-error: true
42-
- name: plan output
43-
id: plan_outcome
44-
run: echo "output=${{steps.plan.outcome}}" >> "$GITHUB_OUTPUT"
45-
- name: Upload plan
46-
uses: actions/upload-artifact@v4
47-
with:
48-
name: output-aws
49-
path: /tmp/*.out
50-
eks_primary:
51-
needs: core_aws
52-
outputs:
53-
plan: ${{ steps.plan_output.outputs.output }}
54-
fmt: ${{ steps.fmt_outcome.outputs.output }}
55-
defaults:
56-
run:
57-
working-directory: core-env/eks-clusters
58-
runs-on: ubuntu-latest
59-
steps:
60-
- uses: actions/checkout@v3
61-
- name: Configure AWS Credentials
62-
uses: aws-actions/configure-aws-credentials@main # Or a specific version
63-
with:
64-
role-to-assume: arn:aws:iam::218691292270:role/sedemo-iac-pipeline-role
65-
aws-region: us-west-2
66-
- name: Verify AWS identity
67-
run: |
68-
# Your commands that require AWS credentials
69-
aws sts get-caller-identity
70-
- name: Verify Tofu
71-
uses: opentofu/setup-opentofu@v1
72-
- name: OpenTofu fmt
73-
id: fmt
74-
run: tofu fmt -check > /tmp/fmt.out
75-
continue-on-error: true
76-
- name: fmt output
77-
id: fmt_outcome
78-
run: echo "output=${{steps.fmt.outcome}}" >> "$GITHUB_OUTPUT"
79-
- run: tofu init
80-
- id: plan
81-
run: tofu plan -no-color > /tmp/plan.out
82-
continue-on-error: true
83-
- name: plan output
84-
id: plan_outcome
85-
run: echo "output=${{steps.plan.outcome}}" >> "$GITHUB_OUTPUT"
86-
- name: Upload plan
87-
uses: actions/upload-artifact@v4
88-
with:
89-
name: output-eks
90-
path: /tmp/*.out
10+
# core_aws:
11+
# outputs:
12+
# plan: ${{ steps.plan_outcome.outputs.output }}
13+
# fmt: ${{ steps.fmt_outcome.outputs.output }}
14+
# defaults:
15+
# run:
16+
# working-directory: core-env/aws
17+
# runs-on: ubuntu-latest
18+
# steps:
19+
# - uses: actions/checkout@v3
20+
# - name: Configure AWS Credentials
21+
# uses: aws-actions/configure-aws-credentials@main # Or a specific version
22+
# with:
23+
# role-to-assume: arn:aws:iam::218691292270:role/sedemo-iac-pipeline-role
24+
# aws-region: us-west-2
25+
# - name: Verify AWS identity
26+
# run: |
27+
# # Your commands that require AWS credentials
28+
# aws sts get-caller-identity
29+
# - name: Verify Tofu
30+
# uses: opentofu/setup-opentofu@v1
31+
# - name: OpenTofu fmt
32+
# id: fmt
33+
# run: tofu fmt -check > /tmp/fmt.out
34+
# continue-on-error: true
35+
# - name: fmt output
36+
# id: fmt_outcome
37+
# run: echo "output=${{steps.fmt.outcome}}" >> "$GITHUB_OUTPUT"
38+
# - run: tofu init
39+
# - id: plan
40+
# run: tofu plan -no-color > /tmp/plan.out
41+
# continue-on-error: true
42+
# - name: plan output
43+
# id: plan_outcome
44+
# run: echo "output=${{steps.plan.outcome}}" >> "$GITHUB_OUTPUT"
45+
# - name: Upload plan
46+
# uses: actions/upload-artifact@v4
47+
# with:
48+
# name: output-aws
49+
# path: /tmp/*.out
50+
# eks_primary:
51+
# needs: core_aws
52+
# outputs:
53+
# plan: ${{ steps.plan_output.outputs.output }}
54+
# fmt: ${{ steps.fmt_outcome.outputs.output }}
55+
# defaults:
56+
# run:
57+
# working-directory: core-env/eks-clusters
58+
# runs-on: ubuntu-latest
59+
# steps:
60+
# - uses: actions/checkout@v3
61+
# - name: Configure AWS Credentials
62+
# uses: aws-actions/configure-aws-credentials@main # Or a specific version
63+
# with:
64+
# role-to-assume: arn:aws:iam::218691292270:role/sedemo-iac-pipeline-role
65+
# aws-region: us-west-2
66+
# - name: Verify AWS identity
67+
# run: |
68+
# # Your commands that require AWS credentials
69+
# aws sts get-caller-identity
70+
# - name: Verify Tofu
71+
# uses: opentofu/setup-opentofu@v1
72+
# - name: OpenTofu fmt
73+
# id: fmt
74+
# run: tofu fmt -check > /tmp/fmt.out
75+
# continue-on-error: true
76+
# - name: fmt output
77+
# id: fmt_outcome
78+
# run: echo "output=${{steps.fmt.outcome}}" >> "$GITHUB_OUTPUT"
79+
# - run: tofu init
80+
# - id: plan
81+
# run: tofu plan -no-color > /tmp/plan.out
82+
# continue-on-error: true
83+
# - name: plan output
84+
# id: plan_outcome
85+
# run: echo "output=${{steps.plan.outcome}}" >> "$GITHUB_OUTPUT"
86+
# - name: Upload plan
87+
# uses: actions/upload-artifact@v4
88+
# with:
89+
# name: output-eks
90+
# path: /tmp/*.out
9191
pr_comment:
92-
needs:
93-
- eks_primary
94-
- aws_core
92+
# needs:
93+
# - eks_primary
94+
# - core_aws
9595
runs-on: ubuntu-latest
9696
steps:
97-
- name: Download artifact
98-
uses: actions/download-artifact@v4
97+
# - name: Download artifact
98+
# uses: actions/download-artifact@v4
9999
- name: Display structure of downloaded files
100-
run: ls -R .
100+
run: |
101+
mkdir output-aws
102+
mkdir output-eks
103+
echo "this is file content" >> output-aws/plan.out
104+
echo "this is file content" >> output-eks/plan.out
105+
ls -R .
101106
- uses: actions/github-script@v6
102107
with:
103108
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)