forked from telia-oss/terraform-aws-ecs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
48 lines (39 loc) · 1.08 KB
/
Taskfile.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
version: '2'
env:
AWS_DEFAULT_REGION: eu-west-1
GO111MODULE: on
tasks:
default:
cmds:
- task: test
test:
desc: Run tests for all terraform directories.
silent: true
env:
DIRECTORIES:
sh: find . -type f -name '*.tf' -not -path "**/.terraform/*" -exec dirname {} \; | sort -u
cmds:
- |
BOLD=$(tput bold)
NORM=$(tput sgr0)
CWD=$PWD
for d in $DIRECTORIES; do
cd $d
echo "${BOLD}$PWD:${NORM}"
if ! terraform fmt -check=true -write=true -list=false -recursive=false; then
echo " ✗ terraform fmt" && exit $?
else
echo " √ terraform fmt"
fi
if ! terraform init -backend=false -input=false -get=true -get-plugins=true -no-color > /dev/null; then
echo " ✗ terraform init" && exit $?
else
echo " √ terraform init"
fi
if ! terraform validate > /dev/null; then
echo " ✗ terraform validate" && exit $?
else
echo " √ terraform validate"
fi
cd $CWD
done