Last active
May 15, 2025 11:51
-
-
Save dynnamitt/71e956efe101763f290091d5dd650a10 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/make -f | |
# needs jq, terraform, git | |
SHA = $(shell git rev-parse --short HEAD) | |
TF_WRKSPC = $(shell terraform workspace show) | |
SUFF = $(SHA)-$(TF_WRKSPC) | |
.PHONY: summary | |
summary: /tmp/delete_$(SUFF).json /tmp/update_$(SUFF).json /tmp/create_$(SUFF).json | |
@echo " -------- DELETE -----------" | |
jq -r '.address' $(word 1,$^) | |
@echo " -------- UPDATE -----------" | |
jq -r '.address' $(word 2,$^) | |
@echo " -------- CREATE -----------" | |
jq -r '.address' $(word 3,$^) | |
/tmp/%_$(SUFF).json: /tmp/plan_$(SUFF).json | |
jq -r '.resource_changes[] | select(.change.actions[0]=="$*")' <$< >$@ | |
/tmp/plan_$(SUFF).json: /tmp/plan_$(SUFF) | |
terraform show -no-color -json $< >$@ | |
/tmp/plan_$(SUFF): | |
terraform plan -out=$@ | |
clean: | |
rm /tmp/plan_$(SUFF) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
make -f deeper-plan.mk
Use jless to execute "deepPlanning" on the separate files.
Usecase: Advanced tf-state move ops