blob: d0b47f7506c91b64f5af5b9e3a0108bb93d2f035 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/sh
TERRAGRUNT_ARGS=()
while [[ $# -gt 0 ]]; do
case $1 in
-full)
FULL=1
shift
;;
-p|--path)
path="$2"
shift
shift
;;
-p=*|--path=*)
path="${1#*=}"
shift
;;
*|-*)
TERRAGRUNT_ARGS+=("$1")
shift
esac
done
TTY=""
case ${TERRAGRUNT_ARGS[0]} in
plan)
TERRAGRUNT_ARGS+=(-no-color -compact-warnings)
;;
apply|destroy)
TTY="-t"
for arg in $TERRAGRUNT_ARGS; do
if [[ $arg -eq "gruntplan" ]]; then
TTY=""
fi
done
TERRAGRUNT_ARGS+=(-no-color -compact-warnings)
;;
init)
TERRAGRUNT_ARGS+=(-no-color -compact-warnings)
;;
esac
VARIABLES=""
REPO="${PWD}"
for var in $(pass show work/env)
do
case $var in
TERRAGRUNT_EXTRA_MOUNTS*)
TERRAGRUNT_EXTRA_MOUNTS="$TERRAGRUNT_EXTRA_MOUNTS ${var#*=}"
;;
*)
VARIABLES="$VARIABLES$(printf ' -e %s' "$var")"
;;
esac
done
for var in $(printenv)
do
case $var in
TF_*)
VARIABLES="$VARIABLES$(printf ' -e %s' $var)"
;;
esac
done
WORKDIR="$REPO/$path"
docker run --rm -i $TTY \
$VARIABLES \
-v $HOME/.terragrunt-cache:/tmp \
-v $HOME/.azure:/root/.azure \
-v $HOME/.netrc:/root/.netrc \
$TERRAGRUNT_EXTRA_MOUNTS \
-v ${REPO}:${REPO} \
-w ${WORKDIR} \
$TERRAGRUNT_CONTAINER terragrunt ${TERRAGRUNT_ARGS[@]} | filter-ansi
|