59 lines (43 loc) · 1.84 KB
/
pr.yaml
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
name: Pull Request
on:
pull_request:
jobs:
terraform-plan-and-apply-and-tfmigrate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up tfenv
uses: rhythmictech/actions-setup-tfenv@v0.1.2
- name: Use tfenv to install required Terraform version
run: make tfenv
- name: Install tfmigrate
run: |
curl \
--fail \
--silent \
--show-error \
--location \
"https://github.com/minamijoyo/tfmigrate/releases/download/v0.3.13/tfmigrate_0.3.13_linux_amd64.tar.gz" \
--output tfmigrate.tar.gz \
tar -zxvf tfmigrate.tar.gz
cp tfmigrate /usr/local/bin/tfmigrate
- name: Start localstack mock AWS environment
run: make up
- name: Bootstrap localstack to have tfmigrate-demo S3 bucket
run: make bootstrap
- name: Terraform plan and apply project-one to create initial configuration
run: make apply-one
- name: Terraform plan and apply project-two to create initial configuration
run: make apply-two
- name: Move local_file.bar HCL from project-one to project-two
if: github.head_ref == 'example-succeeding-pr'
run: make move-bar-to-project-two
- name: Plan tfmigrate migration to migrate local_file.bar from project-one state to project-two state
run: make tfmigrate-plan
- name: Apply tfmigrate migration to migrate local_file.bar from project-one state to project-two state
run: make tfmigrate-apply
- name: Terraform plan and apply project-one to verify there are no outstanding post-migration changes
run: make apply-one
- name: Terraform plan and apply project-two to verify there are no outstanding post-migration changes
run: make apply-two