Skip to content

Test - Failed plan #163

Test - Failed plan

Test - Failed plan #163

name: "Test - Failed plan"
on:
workflow_dispatch: {}
env:
AWS_REGION: us-east-2
# Permissions required for assuming AWS identity
permissions:
id-token: write
contents: read
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup
run: echo "Do setup"
test:
runs-on: ubuntu-latest
continue-on-error: true
needs: [setup]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Plan Atmos Component
id: current
uses: ./
with:
component: "foobar-fail"
stack: "plat-ue2-sandbox"
component-path: "components/terraform/foobar"
terraform-plan-role: ${{ secrets.TERRAFORM_PLAN_ROLE }}
terraform-state-role: ${{ secrets.TERRAFORM_STATE_ROLE }}
terraform-state-bucket: ${{ secrets.TERRAFORM_STATE_BUCKET }}
terraform-state-table: ${{ secrets.TERRAFORM_STATE_TABLE }}
aws-region: ${{ env.AWS_REGION }}
sha: da39a3ee5e6b4b0d3255bfef95601890afd80709
outputs:
result: ${{ steps.current.outcome }}
summary: ${{ steps.current.outputs.summary }}
assert:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: nick-fields/assert-action@v1
with:
expected: 'failure'
actual: "${{ needs.test.outputs.result }}"
- uses: nick-fields/assert-action@v1
with:
actual: "${{ fromJSON(needs.test.outputs.summary) }}"
expected: |
## :x: Plan Failed for `foobar-fail` in `plat-ue2-sandbox`
<a href="https://cloudposse.com/"><img src="https://cloudposse.com/logo-300x69.svg" width="100px" align="right"/></a>
<details><summary><a id="result-plat-ue2-sandbox-foobar-fail" />:warning: Error summary</summary>
<br/>
```hcl
Error: Invalid function argument
on main.tf line 10, in locals:
10: failure = var.enable_failure ? file("Failed because failure mode is enabled") : null
├────────────────
│ while calling file(path)
Invalid value for "path" parameter: no file exists at "Failed because failure
mode is enabled"; this function works only with files that are distributed as
part of the configuration source code, so if this file will be created by a
resource in this configuration you must instead obtain this result from an
attribute of that resource.
exit status 1
```
To reproduce this locally, run:<br/><br/>
```shell
atmos terraform plan foobar-fail -s plat-ue2-sandbox
```
</details>
teardown:
runs-on: ubuntu-latest
needs: [assert]
if: ${{ always() }}
steps:
- name: Tear down
run: echo "Do Tear down"