-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (69 loc) · 2.31 KB
/
ci.yml
File metadata and controls
90 lines (69 loc) · 2.31 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
84
85
86
87
88
89
90
name: Terraform CI
on:
pull_request:
branches:
- 'main'
paths:
- 'terraform/**'
- '.github/workflows/ci.yml'
permissions:
contents: read
pull-requests: write
env:
AWS_REGION: us-west-2
TERRAFORM_VERSION: 1.6.0
jobs:
validate-staging:
name: Validate Staging
runs-on: ubuntu-latest
defaults:
run:
working-directory: terraform/stacks/staging
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_SECRET_ACCESS_ID }} # DO NOT CHANGE THIS LINE
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # DO NOT CHANGE THIS LINE
aws-region: ${{ env.AWS_REGION }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Terraform Format Check
run: terraform fmt -check
- name: Terraform Init
run: terraform init
- name: Terraform Validate
run: terraform validate
- name: Terraform Plan
run: terraform plan -var-file=terraform.tfvars -no-color
validate-production:
name: Validate Production
runs-on: ubuntu-latest
defaults:
run:
working-directory: terraform/stacks/production
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_SECRET_ACCESS_ID }} # DO NOT CHANGE THIS LINE
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # DO NOT CHANGE THIS LINE
aws-region: ${{ env.AWS_REGION }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Terraform Format Check
run: terraform fmt -check
- name: Terraform Init
run: terraform init
- name: Terraform Validate
run: terraform validate
- name: Terraform Plan
run: terraform plan -var-file=terraform.tfvars -no-color