Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added terraform output to summary #34

Merged
merged 88 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
c09d133
Added apply output
goruha Jan 24, 2024
ff51347
Added test-workflows
goruha Jan 24, 2024
31fd492
Added test-workflows
goruha Jan 24, 2024
0b376d2
Added test-workflows
goruha Jan 24, 2024
b166f45
Added test-workflows
goruha Jan 24, 2024
d333b06
Added test-workflows
goruha Jan 24, 2024
65535a5
Added test-workflows
goruha Jan 24, 2024
929ba78
Added test-workflows
goruha Jan 24, 2024
0c1997e
Added test-workflows
goruha Jan 24, 2024
c7c38db
Added test-workflows
goruha Jan 24, 2024
490156e
Added test-workflows
goruha Jan 24, 2024
5d27ce3
Added test-workflows
goruha Jan 24, 2024
0074a5a
Added test-workflows
goruha Jan 24, 2024
ea4b71e
Added test-workflows
goruha Jan 24, 2024
26ea10c
Added test-workflows
goruha Jan 24, 2024
548f507
Added test-workflows
goruha Jan 24, 2024
8b7c970
Added test-workflows
goruha Jan 24, 2024
0180c42
Added test-workflows
goruha Jan 24, 2024
a4c532e
Added test-workflows
goruha Jan 24, 2024
0bc61e8
Added test-workflows
goruha Jan 24, 2024
0f04b7f
Added test-workflows
goruha Jan 24, 2024
a989ecd
Added test-workflows
goruha Jan 24, 2024
9cca985
Added test-workflows
goruha Jan 24, 2024
bf25ac4
Added test-workflows
goruha Jan 24, 2024
c1e534d
Added test-workflows
goruha Jan 24, 2024
fdd069e
Added test-workflows
goruha Jan 24, 2024
5351dd7
Added test-workflows
goruha Jan 24, 2024
2346dfa
Added test-workflows
goruha Jan 24, 2024
363e07d
Added test-workflows
goruha Jan 24, 2024
7a16dac
Added test-workflows
goruha Jan 24, 2024
99af067
Added test-workflows
goruha Jan 24, 2024
768e46f
Added test-workflows
goruha Jan 24, 2024
4906dbd
Added test-workflows
goruha Jan 24, 2024
1fd80f1
Added test-workflows
goruha Jan 24, 2024
e2bf5f3
Added test-workflows
goruha Jan 25, 2024
d9c2fc3
Added test-workflows
goruha Jan 25, 2024
a98106a
Added test-workflows
goruha Jan 25, 2024
f1c10fb
Added test-workflows
goruha Jan 25, 2024
180027b
Added test-workflows
goruha Jan 25, 2024
5f417e9
Added test-workflows
goruha Jan 25, 2024
a384b9c
Added test-workflows
goruha Jan 25, 2024
f675240
Added test-workflows
goruha Jan 25, 2024
f3776a9
Added test-workflows
goruha Jan 25, 2024
f07c5c2
Added test-workflows
goruha Jan 25, 2024
02cafa1
Added test-workflows
goruha Jan 25, 2024
7977ece
Added test-workflows
goruha Jan 25, 2024
45d8b47
Added test-workflows
goruha Jan 25, 2024
a40bc8a
Added test-workflows
goruha Jan 25, 2024
f86e6d7
Added test-workflows
goruha Jan 25, 2024
5936d4b
Added test-workflows
goruha Jan 25, 2024
3a9b49d
Added test-workflows
goruha Jan 25, 2024
cab7b1d
Added test-workflows
goruha Jan 25, 2024
ae0aa0d
Added test-workflows
goruha Jan 25, 2024
c473941
Added test-workflows
goruha Jan 25, 2024
48e59d4
Added test-workflows
goruha Jan 25, 2024
fdabcad
Added test-workflows
goruha Jan 25, 2024
f0b2c4a
Added test-workflows
goruha Jan 25, 2024
c5ed816
Added test-workflows
goruha Jan 25, 2024
3ff9cec
Added test-workflows
goruha Jan 25, 2024
8b9e8d7
Added test-workflows
goruha Jan 25, 2024
3d0267d
Added test-workflows
goruha Jan 25, 2024
c3eb6cd
Added test-workflows
goruha Jan 25, 2024
38ff25d
Added test-workflows
goruha Jan 25, 2024
8ae7535
Added test-workflows
goruha Jan 25, 2024
f291d81
Added test-workflows
goruha Jan 25, 2024
20cddf4
Added test-workflows
goruha Jan 25, 2024
6857d3b
Added test-workflows
goruha Jan 25, 2024
7a05639
Added test-workflows
goruha Jan 25, 2024
0cffb14
Added test-workflows
goruha Jan 25, 2024
c486549
Added test-workflows
goruha Jan 25, 2024
5f68b7a
Added test-workflows
goruha Jan 25, 2024
026ba41
Added test-workflows
goruha Jan 25, 2024
64ad08e
Added test-workflows
goruha Jan 25, 2024
cc29a39
Added test-workflows
goruha Jan 25, 2024
dce4c2a
Added test-workflows
goruha Jan 25, 2024
2a837f1
Added test-workflows
goruha Jan 25, 2024
f134169
Added test-workflows
goruha Jan 25, 2024
a3e1c1a
Added test-workflows
goruha Jan 25, 2024
51faf91
Added test-workflows
goruha Jan 25, 2024
d41bbe1
Added test-workflows
goruha Jan 25, 2024
e9ca2ab
Added test-workflows
goruha Jan 25, 2024
e832035
Added test-workflows
goruha Jan 25, 2024
3dfcacd
Added test-workflows
goruha Jan 25, 2024
7d7d7cc
Added test-workflows
goruha Jan 25, 2024
6b2fe77
Added test-workflows
goruha Jan 25, 2024
19ac9fd
Added test-workflows
goruha Jan 25, 2024
87cb853
Added test-workflows
goruha Jan 25, 2024
3095d63
Added test-workflows
goruha Jan 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
AWS_REGION: us-east-2


# Permissions required for assuming AWS identity
permissions:
id-token: write
Expand All @@ -35,11 +36,12 @@ jobs:
EOL

- name: Plan Atmos Component
uses: cloudposse/github-action-atmos-terraform-plan@incapsulate-configs
uses: cloudposse/github-action-atmos-terraform-plan@v1
with:
component: "foobar"
stack: "plat-ue2-sandbox"
atmos-gitops-config-path: "${{ runner.temp }}/atmos-gitops.yaml"

test:
runs-on: ubuntu-latest
needs: setup
Expand Down
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,57 @@ specific language governing permissions and limitations
under the License.
```


## Apply Succeeded for `foobar` in `plat-ue2-sandbox`



<a href="https://cloudposse.com/"><img src="https://cloudposse.com/logo-300x69.svg" width="100px" align="right"/></a>


[![apply](https://shields.io/badge/APPLY-SUCCESS-success?style=for-the-badge)](#user-content-apply-plat-ue2-sandbox-foobar)


<details><summary><a id="result-plat-ue2-sandbox-foobar" />Apply complete! Resources: 1 added, 0 changed, 1 destroyed.</summary>

<br/>
To reproduce this locally, run:<br/><br/>

```shell
atmos terraform apply foobar -s plat-ue2-sandbox
```
</details>


<details><summary><a id="apply-plat-ue2-sandbox-foobar" />Terraform <strong>Apply</strong> Summary</summary>

```hcl
random_id.foo: Destroying... [id=oIE_s3bSF9A]
random_id.foo: Destruction complete after 0s
random_id.foo: Creating...
random_id.foo: Creation complete after 0s [id=WGAQulCR148]

Apply complete! Resources: 1 added, 0 changed, 1 destroyed.

Outputs:

result = "WGAQulCR148"
sensitive_value = <sensitive>

```

</details>

<details><summary><a id="outputs-plat-ue2-sandbox-foobar" />Terraform Outputs</summary>

| name | value |
|----|---------------|
| result | "WGAQulCR148" |
| sensitive_value | \<sensitive\> |

</details>


## Trademarks

All other trademarks referenced herein are the property of their respective owners.
Expand Down
18 changes: 18 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ runs:
repo: suzuki-shunsuke/tfcmt
tag: v4.6.0

- name: Install terraform-docs
if: env.ACTIONS_ENABLED == 'true'
uses: jaxxstorm/[email protected]
with:
repo: terraform-docs/terraform-docs
tag: v0.17.0

- name: Define Job Variables
if: env.ACTIONS_ENABLED == 'true'
id: vars
Expand Down Expand Up @@ -289,6 +296,17 @@ runs:
--output "${{ github.workspace }}/atmos-apply-summary.md" \
--log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \
apply -- terraform apply ${{ steps.vars.outputs.plan_file }} || EXIT_CODE=$?

terraform output --json > output_values.json

echo "terraform-docs -c ${{ github.action_path }}config/tfdocs-config.yaml ./"

terraform-docs -c ${{ github.action_path }}config/tfdocs-config.yaml --output-file ${{ github.workspace }}/atmos-apply-summary.md ./

sed -i "s#\`<sensitive>\`#![Sensitive](https://img.shields.io/badge/sensitive-c40000?style=for-the-badge)#g" ${{ github.workspace }}/atmos-apply-summary.md
sed -i "s#\`\"#\`#g" ${{ github.workspace }}/atmos-apply-summary.md
sed -i "s#\"\`#\`#g" ${{ github.workspace }}/atmos-apply-summary.md
sed -i "s#|--#|:-#g" ${{ github.workspace }}/atmos-apply-summary.md

cat "${{ github.workspace }}/atmos-apply-summary.md" >> $GITHUB_STEP_SUMMARY

Expand Down
9 changes: 9 additions & 0 deletions config/atmos_github_summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ terraform:
<details><summary><a id="apply-{{.Vars.stack}}-{{.Vars.component}}" />Terraform <strong>Apply</strong> Summary</summary>
{{wrapCode .CombinedOutput}}
</details>

<details><summary><a id="outputs-{{.Vars.stack}}-{{.Vars.component}}" />Terraform Outputs</summary>

[//]: # (BEGIN_TF_DOCS)

[//]: # (END_TF_DOCS)

</details>

{{if ne .Vars.infracost_details_diff_breakdown ""}}
{{template "infracost" .}}
{{end}}
Expand Down
40 changes: 40 additions & 0 deletions config/tfdocs-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
formatter: "markdown"

sections:
show:
- outputs

content: |-
{{ .Outputs }}

output:
file: "atmos-apply-summary.md"
mode: inject
template: |-
[//]: # (BEGIN_TF_DOCS)
{{ .Content }}

[//]: # (END_TF_DOCS)

output-values:
enabled: true
from: "output_values.json"

sort:
enabled: true
by: name

settings:
anchor: false
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: true
read-comments: true
required: true
sensitive: false
type: true
21 changes: 21 additions & 0 deletions tests/components/terraform/foobar/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
output "result" {
description = "Test description output"
value = random_id.foo.id
}

output "sensitive_value" {
description = "Test sensitive description output"
value = random_id.foo.id
sensitive = true
}


output "structured_value" {
description = "Test structured output"
value = {
test = "test"
value = {
result = random_id.foo.id
}
}
}
Loading