Skip to content

Instantly share code, notes, and snippets.

@nilium
Created January 19, 2019 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilium/cc07b9c7991d5e5f2410cca81482a6fe to your computer and use it in GitHub Desktop.
Save nilium/cc07b9c7991d5e5f2410cca81482a6fe to your computer and use it in GitHub Desktop.
Terraform makefiles (bmake, gmake)
TF_MODULES := $(shell find . -type f -iname '*.tf')
.PHONY: all plan apply
all: plan
plan: tf.plan
apply: tf.plan
terraform apply $<
tf.plan: ${TF_MODULES}
terraform plan -out $@
TF_MODULES != find . -type f -iname '*.tf'
.PHONY: all plan apply
all: plan
plan: tf.plan
apply: tf.plan
terraform apply ${.ALLSRC}
tf.plan: ${TF_MODULES}
terraform plan -out ${.TARGET}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment