Skip to content

cutover to sn10 (#143) #54

cutover to sn10 (#143)

cutover to sn10 (#143) #54

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