37 lines
		
	
	
		
			434 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			434 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
set -e
 | 
						|
 | 
						|
opt=$1
 | 
						|
plan=tfplan
 | 
						|
 | 
						|
build_plan() {
 | 
						|
	echo Generating plan
 | 
						|
	set -x
 | 
						|
	terraform plan -var-file variables.tfvars -input=false -out $plan
 | 
						|
}
 | 
						|
 | 
						|
deploy_plan() {
 | 
						|
	terraform apply $plan
 | 
						|
}
 | 
						|
 | 
						|
init() {
 | 
						|
	terraform init
 | 
						|
}
 | 
						|
 | 
						|
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;;
 | 
						|
	init) init;;
 | 
						|
	*) help_prompt;;
 | 
						|
esac
 | 
						|
 |