Created
April 13, 2018 01:56
-
-
Save matschaffer/0baa2b52359df178ae793de38e046afd to your computer and use it in GitHub Desktop.
Terraform makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL = /bin/bash | |
terraform_opts ?= | |
terraform_plan_opts ?= | |
.PHONY: help | |
help:: | |
@echo | |
@echo Infrastructure management using Terraform. | |
@echo | |
@echo "## Common management tasks:" | |
@echo | |
@echo "init - initializes state and loads modules" | |
@echo "clean - removes initialized state and modules" | |
@echo "plan - shows changes to be applied" | |
@echo "apply - shows changes to be applied, prompts for confirmation, then applies if confirmed" | |
@echo "destroy - shows items to destroy, prompts for confirmation, then destroys if confirmed" | |
@echo | |
.PHONY: install-providers | |
install-providers:: | |
@true | |
.PHONY: init | |
init: install-providers | |
@terraform init -get=true -input=false | |
.PHONY: clean | |
clean: | |
rm -rf .terraform | |
.PHONY: plan | |
plan: install-providers | |
@terraform plan $(terraform_plan_opts) $(terraform_opts) | |
.PHONY: apply | |
apply: install-providers | |
@terraform apply -auto-approve=false $(terraform_plan_opts) $(terraform_opts) | |
.PHONY: destroy | |
destroy: install-providers | |
@terraform destroy $(terraform_plan_opts) $(terraform_opts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment