From 418c813ddb45fc559897a9d157452f8e13e706a4 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 21 Feb 2020 18:51:06 +0000 Subject: [PATCH] Add CI to validate terraform --- .github/workflows/terraform.yml | 17 +++++++++++++++++ README.md | 1 + scripts/terraform-lint.sh | 4 ++++ 3 files changed, 22 insertions(+) create mode 100644 .github/workflows/terraform.yml diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml new file mode 100644 index 0000000..41faefa --- /dev/null +++ b/.github/workflows/terraform.yml @@ -0,0 +1,17 @@ +name: Terraform + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Install terraform + - uses: marocchino/setup-terraform@v1 + with: + version: "0.12.20" + - name: Initialize Terraform + run: terraform init + - name: Lint + run: ./scripts/terraform-lint.sh diff --git a/README.md b/README.md index 8bab0be..6c67cd9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Infrastructure ![Ansible Status](https://github.com/realorangeone/infrastructure/workflows/Ansible/badge.svg) +![Terraform Status](https://github.com/realorangeone/infrastructure/workflows/Terraform/badge.svg) ![Generic Linting](https://github.com/realorangeone/infrastructure/workflows/Lint/badge.svg) ## Requirements diff --git a/scripts/terraform-lint.sh b/scripts/terraform-lint.sh index 80088c1..7c456df 100755 --- a/scripts/terraform-lint.sh +++ b/scripts/terraform-lint.sh @@ -4,4 +4,8 @@ set -e cd terraform/ +set -x + +terraform validate + terraform fmt -check -recursive