Created
January 28, 2024 23:14
-
-
Save theipster/5e370f7b0671585bda491f423fd6e719 to your computer and use it in GitHub Desktop.
Tool for validating whether a Terraform plan is a pure refactor (i.e. zero changes)
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
#!/bin/sh | |
# Given a terraform plan at plan.json... | |
is_refactor=$(jq --exit-status -null-input '[inputs | .resource_changes[].change.actions[] | test("^(read|no-op)$")] | all' plan.json) | |
# If it's a refactor, do something - e.g. auto-approve a pull request. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment