From 43cc61cd535609b59948ba75d8d9ea859bf8d990 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Tue, 13 Aug 2024 15:59:08 +0100 Subject: ci: add terraform quality checks --- .github/workflows/terraform.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/terraform.yml (limited to '.github/workflows/terraform.yml') diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml new file mode 100644 index 0000000..d28a357 --- /dev/null +++ b/.github/workflows/terraform.yml @@ -0,0 +1,34 @@ +name: terraform-quality-checks + +on: + push: + branches: [development] + paths: + - 'terraform/**.tf' + - 'terraform/**.tfvars' + pull_request: + branches: [development, staging] + paths: + - 'terraform/**.tf' + - 'terraform/**.tfvars' +jobs: + terraform-validation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: latest # Using the latest version, but not sure if it's the best practice + - name: Format + run: terraform fmt -check -recursive + - name: Init + run: terraform init -backend=false + - name: Validate + run: terraform validate + - name: Setup TFLint + uses: terraform-linters/setup-tflint@v2 + with: + tflint_version: latest + - name: Run TFLint + run: tflint -f compact \ No newline at end of file -- cgit v1.2.3