Build script that doesnt totally suck IG
This commit is contained in:
parent
b6e3010126
commit
fb2350077e
@ -1,24 +0,0 @@
|
|||||||
plan=out.plan
|
|
||||||
|
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
$(plan): *.tf
|
|
||||||
source ./secrets.sh && terraform plan -var-file variables.tfvars -input=false -out $(plan)
|
|
||||||
|
|
||||||
push: build
|
|
||||||
source ./secrets.sh && terraform apply $(plan)
|
|
||||||
|
|
||||||
refresh:
|
|
||||||
source ./secrets.sh && terraform apply -refresh-only
|
|
||||||
|
|
||||||
test:
|
|
||||||
terraform validate
|
|
||||||
|
|
||||||
|
|
||||||
rip:
|
|
||||||
source ./secrets.sh && terraform plan -destroy -var-file variables.tfvars -input=false -out $(plan)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(plan)
|
|
||||||
|
|
||||||
.PHONY: test build clean push rip
|
|
@ -2,14 +2,30 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
plan=out.plan
|
opt=$1
|
||||||
|
plan=tfplan
|
||||||
|
|
||||||
refresh=$1
|
build_plan() {
|
||||||
|
echo Generating plan
|
||||||
plan() {
|
|
||||||
set -x
|
set -x
|
||||||
terraform plan -var-file variables.tfvars -input=false -out $plan
|
terraform plan -var-file variables.tfvars -input=false -out $plan
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ -z "$refresh " ]] && plan || source ./secrets.sh && plan
|
deploy_plan() {
|
||||||
|
echo deploy
|
||||||
|
}
|
||||||
|
|
||||||
|
help_prompt() {
|
||||||
|
cat <<- EOF
|
||||||
|
Options: plan deploy help
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Default to building a plan
|
||||||
|
source ./secrets.sh
|
||||||
|
case $opt in
|
||||||
|
plan) build_plan;;
|
||||||
|
deploy) deploy_plan;;
|
||||||
|
*) help_prompt;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user