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