generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
47 lines (41 loc) · 1.3 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
author: AVM
name: e2e - testexamples
description: Tests the example supplied in the input. Needs checkout and Azure login prior.
inputs:
example:
description: The example directory to test
required: true
runs:
using: composite
steps:
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ">=1.5.0"
- name: terraform init
run: terraform init
working-directory: examples/${{ inputs.example }}
shell: bash
- name: terraform apply
run: terraform apply -auto-approve
working-directory: examples/${{ inputs.example }}
shell: bash
- name: terraform plan
id: plan
run: |
terraform plan -detailed-exitcode
echo PLANCODE="$?" >> "$GITHUB_OUTPUT"
continue-on-error: true
working-directory: examples/${{ inputs.example }}
shell: bash
- name: check idempotent
run: |
echo Error: terraform plan code is ${{ steps.plan.outputs.PLANCODE }}
exit 1
working-directory: examples/${{ inputs.example }}
shell: bash
if: steps.plan.outputs.PLANCODE != 0
- name: terraform destroy
run: terraform destroy -auto-approve
working-directory: examples/${{ inputs.example }}
shell: bash
if: always()