forked from cloudposse/github-action-atmos-terraform-apply
-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (71 loc) · 2.74 KB
/
test-basic.yml
File metadata and controls
83 lines (71 loc) · 2.74 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: "Integration Tests"
on:
workflow_dispatch:
inputs:
ref:
description: "The fully-formed ref of the branch or tag that triggered the workflow run"
required: false
type: string
sha:
description: "The sha of the commit that triggered the workflow run"
required: false
type: string
env:
AWS_REGION: us-east-2
# Permissions required for assuming AWS identity
permissions:
id-token: write
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false # Don't fail fast to avoid locking TF State
matrix:
platform: [terraform, opentofu]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- shell: bash
id: env
run: |
mkdir -p ${{ runner.temp }}
cp ./tests/${{ matrix.platform }}/atmos.yaml ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_APPLY_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_APPLY_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
echo "seed=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${{ matrix.platform }}" >> $GITHUB_OUTPUT
- name: Plan Atmos Component
uses: cloudposse/github-action-atmos-terraform-plan@v5
with:
component: "foobar"
stack: "plat-ue2-sandbox"
atmos-config-path: ${{ runner.temp }}
debug: true
sha: ${{ inputs.sha }}
env:
TF_VAR_seed: ${{ steps.env.outputs.seed }}
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Wait 60 sec to wait s3 bucket would be consistent (read after write consistency)
shell: bash
run: |
sleep 60;
- name: Apply Atmos Component
uses: ./
with:
component: "foobar"
stack: "plat-ue2-sandbox"
atmos-config-path: ${{ runner.temp }}
debug: true
sha: ${{ inputs.sha }}
env:
TF_VAR_seed: ${{ steps.env.outputs.seed }}