Skip to content

Instantly share code, notes, and snippets.

@ozbillwang
Created August 1, 2017 12:07
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozbillwang/a8639f7cca5de36f2bd3c398aacb5e6b to your computer and use it in GitHub Desktop.
Save ozbillwang/a8639f7cca5de36f2bd3c398aacb5e6b to your computer and use it in GitHub Desktop.
terraform validates with Travis CI
env:
- tf_version=0.8.8
- tf_version=0.9.11
sudo: required
language: bash
before_install:
- wget https://releases.hashicorp.com/terraform/${tf_version}/terraform_${tf_version}_linux_amd64.zip -O /tmp/terraform.zip
- sudo unzip -d /usr/local/bin/ /tmp/terraform.zip
script:
- make test
- make fmt
modules = $(shell find . -type f -name "*.tf" -exec dirname {} \;|sort -u)
.PHONY: test
default: test
test:
@for m in $(modules); do (terraform validate "$$m" && echo "√ $$m") || exit 1 ; done
fmt:
@if [ `terraform fmt | wc -c` -ne 0 ]; then echo "terraform files need be formatted"; exit 1; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment