Add plan/apply wrapper scripts
This commit is contained in:
parent
32f768a7ac
commit
850a4b5b7e
2 changed files with 19 additions and 0 deletions
11
scripts/apply.sh
Executable file
11
scripts/apply.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Apply a previously generated plan. Never auto-approves in prod.
|
||||||
|
set -euo pipefail
|
||||||
|
ENV="${1:?Usage: apply.sh <staging|prod>}"
|
||||||
|
cd "$(dirname "$0")/../terraform/envs/$ENV"
|
||||||
|
if [ "$ENV" = "prod" ]; then
|
||||||
|
echo "[apply] WARNING: applying to PRODUCTION."
|
||||||
|
read -rp "Type 'yes' to continue: " confirm
|
||||||
|
[ "$confirm" = "yes" ] || { echo "Aborted."; exit 1; }
|
||||||
|
fi
|
||||||
|
terraform apply tfplan
|
||||||
8
scripts/plan.sh
Executable file
8
scripts/plan.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Wrapper around terraform plan with colour output and cost estimation.
|
||||||
|
set -euo pipefail
|
||||||
|
ENV="${1:?Usage: plan.sh <staging|prod>}"
|
||||||
|
cd "$(dirname "$0")/../terraform/envs/$ENV"
|
||||||
|
terraform init -input=false
|
||||||
|
terraform plan -out=tfplan -input=false
|
||||||
|
echo "[plan] Run './scripts/apply.sh $ENV' to apply."
|
||||||
Loading…
Reference in a new issue