Skip to content

Instantly share code, notes, and snippets.

@p0bailey p0bailey/Makefile
Created Apr 4, 2017

Embed
What would you like to do?
Terraform Makefile
MAKEFLAGS += --silent
.PHONY: all init plan apply show destroy output graph
all:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
init: ## Initialize a new or existing Terraform configuration
terraform get
terraform validate
terraform init
plan: ## Generate and show an execution plan.
terraform get
terraform validate
terraform plan
apply: plan ## Builds or changes infrastructure.
terraform apply
show: ## Inspect Terraform state or plan.
terraform show
destroy: ## Destroy Terraform-managed infrastructure. BE CAREFUL!!!
terraform destroy
output: ## Read an output from a state file
terraform get
terraform plan
terraform refresh
terraform output -module=demo_vpc
terraform output -module=demo_sg_ssh
terraform output -module=demo_sg_app
terraform output -module=demo_ec2
graph: ## Create a visual graph of Terraform resources
rm -f graph.png
terraform graph -draw-cycles -module-depth=-1 | dot -Tpng > graph.png
showimage graph.png &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.