-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
31 lines (26 loc) · 962 Bytes
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
language: bash
env:
- TERRAFORM_VERSION=1.5.4
branches:
only:
- master
install:
# Install Terraform.
- curl -fSL "https://releases.hashicorp.com/terraform/1.5.4/terraform_1.5.4_linux_amd64.zip" -o terraform.zip
- sudo unzip terraform.zip -d /opt/terraform
- sudo ln -s /opt/terraform/terraform /usr/bin/terraform
- rm -f terraform.zip
script:
# Check the syntax of terraform
#- cd env/dev/ && terraform init
#- cd env/dev/ && terraform validate
- |
dir=$(pwd)
for folderpath in $(find env/ -maxdepth 1 -mindepth 1 -type d); do
foldername=$(echo $folderpath | cut -d '/' -f2)
cd $dir/$folderpath && terraform init -var-file=$foldername.variables.tfvar -backend-config=$foldername.backend.tfvar ../../deployment
cd $dir/$folderpath && terraform fmt -check=true ../../deployment
cd $dir/$folderpath && terraform validate -var-file=$foldername.variables.tfvar ../../deployment
done
- terraform -v