Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (27 sloc) 1.06 KB
version: 2
terraform: &terraform
docker:
- image: hashicorp/terraform:0.11.1
working_directory: /tmp/workspace/terraform
jobs:
validate:
<<: *terraform
steps:
- checkout
- run:
name: Validate Terraform configurations
command: find . -type f -name "*.tf" -exec dirname {} \;|sort -u | while read m; do (terraform validate -check-variables=false "$m" && echo "√ $m") || exit 1 ; done
- run:
name: Check if Terraform configurations are properly formatted
command: files=$(terraform fmt -write=false); if [ -n "$files" ]; then echo "$files"; echo -e "\nSome terraform files need be formatted, run 'terraform fmt' to fix"; exit 1; fi
- run:
name: Install tflint
command: curl -L -o /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.5.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin
- run:
name: Check Terraform configurations with tflint
command: tflint
workflows:
version: 2
build:
jobs:
- validate