Skip to content
Permalink
main
Go to file
 
 
Cannot retrieve contributors at this time
30 lines (27 sloc) 1.17 KB
version: 2
terraform: &terraform
docker:
- image: hashicorp/terraform:0.13.1
working_directory: /tmp/workspace/terraform
jobs:
validate:
<<: *terraform
steps:
- checkout
- run:
name: Validate Terraform configurations
command: find . -type f -name "*.tf" -exec dirname {} \; | grep -v '/modules/' | sort -u | while read m; do (echo "START> $m" && terraform init -input=false -backend=false "$m" && terraform validate "$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: apk update && apk add curl curl-dev && curl -L -o /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.19.1/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
You can’t perform that action at this time.