diff --git a/infra/vultr-kubernetes/Makefile b/infra/vultr-kubernetes/Makefile deleted file mode 100644 index 6f1d983..0000000 --- a/infra/vultr-kubernetes/Makefile +++ /dev/null @@ -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 diff --git a/infra/vultr-kubernetes/build.sh b/infra/vultr-kubernetes/build.sh index 6de6435..cb6caac 100644 --- a/infra/vultr-kubernetes/build.sh +++ b/infra/vultr-kubernetes/build.sh @@ -2,14 +2,30 @@ set -e -plan=out.plan +opt=$1 +plan=tfplan -refresh=$1 - -plan() { +build_plan() { + echo Generating plan set -x 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