Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

git lfs install
15 changes: 11 additions & 4 deletions sandbox-deploy/terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ $0: Run terraform commands against a given environment

Usage:
$0 -h
$0 [-f] [-c <TERRAFORM-CMD>] [-- <EXTRA CMD ARGUMENTS>]
$0 [-f] [-c <TERRAFORM-CMD>] [-r] [-- <EXTRA CMD ARGUMENTS>]

Options:
-h: show help and exit
-f: Force, pass -auto-approve to all invocations of terraform
-r: Replace worker space, useful to reset after using PRESERVE_WORKER

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪩

-c TERRAFORM-CMD: command to run. Defaults to $cmd
[<EXTRA CMD ARGUMENTS>]: arguments to pass as-is to terraform
"


force=""
args_to_shift=0
declare -a optional_args

set -e
while getopts ":hfc:" opt; do
while getopts ":hfrc:" opt; do
case "$opt" in
f)
force="-auto-approve"
Expand All @@ -31,6 +33,11 @@ while getopts ":hfc:" opt; do
cmd=${OPTARG}
args_to_shift=$((args_to_shift + 2))
;;
r)
optional_args+=(-replace=module.sandbox-runner.module.worker_space.cloudfoundry_space.space)
optional_args+=(-replace="module.sandbox-runner.module.worker_space.cloudfoundry_security_group_space_bindings.security_group_bindings[\"trusted_local_networks_egress\"]")
args_to_shift=$((args_to_shift + 1))
;;
h)
echo "$usage"
exit 0
Expand All @@ -48,6 +55,6 @@ cf org $dev_org &> /dev/null || cf login -a api.fr-stage.cloud.gov --sso -o $dev

terraform init
echo "=============================================================================================================="
echo "= Calling $cmd $force $@ on the sandbox infrastructure"
echo "= Calling $cmd $force " "${optional_args[@]}" " " "$@" " on the sandbox infrastructure"
echo "=============================================================================================================="
terraform "$cmd" $force -compact-warnings "$@"
terraform "$cmd" $force -compact-warnings "${optional_args[@]}" "$@"