Member-only story
Building a really simple GitHub Actions CI ‘workflow’ to validate Terraform code

In this short story i am going to show you exactly how you can easily construct a really simple CI (Continuous Integration) ‘workflow’ as part of your DevOps workflows to validate your infrastructure Terraform code when you merge in Terraform code to your GitHub code repository.
TL:DR
If you just want me to show you the full snippet code here it is.
*but i do encourage you to read on and see my explanations of each step in terms of what it is actually doing and why we are doing it. It is important to understand the code you write and not rely on CPD (Copy & Paste Development)^.
^another thing for another day…
name: PR Build
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
container: colinbut/terraform-build-container:1.0.0
steps:
- name: checkout
uses: actions/checkout@v3
- name: terraform validate
run: terraform validate
- name: run tflint
run: tflint terraform
- name: run tfsec
run: tfsec .
What does the code do?
Okay, so what does the code do then?