Skip to content

Commit bbba2f3

Browse files
authored
fix: JSON Planfile Conversion (#104)
* added cache input * cache key includes command * Add restore-keys for caching in Atmos Terraform Plan step * Fix working-directory path in action.yml * Initialize terraform and show plan in JSON format * debug * debug * debug * clean up * clean up * make readme * Update action.yml to convert planfile to JSON if enabled
1 parent c6ce879 commit bbba2f3

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ Which would produce the same behavior as in `v1`, doing this:
401401

402402

403403

404+
405+
406+
407+
404408
<!-- markdownlint-disable -->
405409

406410
## Inputs

action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ runs:
407407
408408
rm -f ${TERRAFORM_OUTPUT_FILE}
409409
410+
# Convert planfile to JSON if Infracost is enabled
411+
# Infracost requires a JSON representation of the plan to analyze cost changes
412+
if [[ "${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" == "true" && "${TERRAFORM_RESULT}" == "0" ]]; then
413+
cd "${{ steps.vars.outputs.component_path }}"
414+
${{ fromJson(steps.atmos-settings.outputs.settings).command }} show -json "${{ steps.vars.outputs.plan_file }}" > "${{ steps.vars.outputs.plan_file }}.json"
415+
fi
416+
410417
- name: Configure State AWS Credentials
411418
uses: aws-actions/configure-aws-credentials@v4
412419
if: ${{ ( fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' ||
@@ -467,13 +474,6 @@ runs:
467474
with:
468475
api-key: ${{ inputs.infracost-api-key }}
469476

470-
- name: Convert PLANFILE to JSON
471-
if: ${{ steps.atmos-plan.outputs.changes == 'true' }}
472-
shell: bash
473-
working-directory: ./${{ steps.vars.outputs.component_path }}
474-
run: |
475-
${{ fromJson(steps.atmos-settings.outputs.settings).command }} show -json "${{ steps.vars.outputs.plan_file }}" > "${{ steps.vars.outputs.plan_file }}.json"
476-
477477
- name: Set Plan Results
478478
id: results
479479
shell: bash

docs/github-action.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
| Name | Description | Default | Required |
66
|------|-------------|---------|----------|
77
| atmos-config-path | The path to the atmos.yaml file | N/A | true |
8-
| atmos-version | The version of atmos to install | >= 1.99.0 | false |
8+
| atmos-version | The version of atmos to install | >= 1.158.0 | false |
99
| branding-logo-image | Branding logo image url | https://cloudposse.com/logo-300x69.svg | false |
1010
| branding-logo-url | Branding logo url | https://cloudposse.com/ | false |
1111
| component | The name of the component to plan. | N/A | true |

0 commit comments

Comments
 (0)