-
Notifications
You must be signed in to change notification settings - Fork 18
60 lines (48 loc) · 1.61 KB
/
sld_terraform.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
60
name: "SLD Terraform"
on:
push:
branches:
- master
workflow_dispatch:
branches:
- master
permissions: read-all
defaults:
run:
working-directory: sld
env:
# Credentials for name dot com
TF_VAR_name_dot_com_user: ${{ secrets.TF_VAR_name_dot_com_user }}
TF_VAR_name_dot_com_token: ${{ secrets.TF_VAR_name_dot_com_token }}
# Credentials for deployment to AWS
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# S3 bucket for the Terraform state
BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE}}
jobs:
terraform:
name: "Terraform"
environment: prod
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # @v4
- name: Setup Terraform with specified version on the runner
uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # @v3
with:
terraform_version: 1.8.3
- name: Terraform init
id: init
run: terraform init -backend-config="bucket=$BUCKET_TF_STATE"
- name: Terraform format
id: fmt
run: terraform fmt -check
- name: Terraform validate
id: validate
run: terraform validate
- name: Terraform plan
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: terraform plan -no-color -input=false -parallelism=1
- name: Terraform Apply
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false -parallelism=1