@@ -7,21 +7,23 @@ $0: Run terraform commands against a given environment
77
88Usage:
99 $0 -h
10- $0 [-f] [-c <TERRAFORM-CMD>] [-- <EXTRA CMD ARGUMENTS>]
10+ $0 [-f] [-c <TERRAFORM-CMD>] [-r] [- - <EXTRA CMD ARGUMENTS>]
1111
1212Options:
1313-h: show help and exit
1414-f: Force, pass -auto-approve to all invocations of terraform
15+ -r: Replace worker space, useful to reset after using PRESERVE_WORKER
1516-c TERRAFORM-CMD: command to run. Defaults to $cmd
1617[<EXTRA CMD ARGUMENTS>]: arguments to pass as-is to terraform
1718"
1819
1920
2021force=" "
2122args_to_shift=0
23+ declare -a optional_args
2224
2325set -e
24- while getopts " :hfc :" opt; do
26+ while getopts " :hfrc :" opt; do
2527 case " $opt " in
2628 f)
2729 force=" -auto-approve"
@@ -31,6 +33,11 @@ while getopts ":hfc:" opt; do
3133 cmd=${OPTARG}
3234 args_to_shift=$(( args_to_shift + 2 ))
3335 ;;
36+ r)
37+ optional_args+=(-replace=module.sandbox-runner.module.worker_space.cloudfoundry_space.space)
38+ optional_args+=(-replace=" module.sandbox-runner.module.worker_space.cloudfoundry_security_group_space_bindings.security_group_bindings[\" trusted_local_networks_egress\" ]" )
39+ args_to_shift=$(( args_to_shift + 1 ))
40+ ;;
3441 h)
3542 echo " $usage "
3643 exit 0
@@ -48,6 +55,6 @@ cf org $dev_org &> /dev/null || cf login -a api.fr-stage.cloud.gov --sso -o $dev
4855
4956terraform init
5057echo " =============================================================================================================="
51- echo " = Calling $cmd $force $@ on the sandbox infrastructure"
58+ echo " = Calling $cmd $force " " ${optional_args[@]} " " " " $@ " " on the sandbox infrastructure"
5259echo " =============================================================================================================="
53- terraform " $cmd " $force -compact-warnings " $@ "
60+ terraform " $cmd " $force -compact-warnings " ${optional_args[@]} " " $ @"
0 commit comments