Created
August 1, 2017 12:07
-
-
Save ozbillwang/a8639f7cca5de36f2bd3c398aacb5e6b to your computer and use it in GitHub Desktop.
terraform validates with Travis CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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