Open jason-johnson opened 1 year ago
I track this project and while I've not got the ability to contribute directly I have used the following successfully in ADO pipelines in BASH to detect changes using jquery (jq). I wonder if you could use jquery within typescript to achieve the same, more robustly than with regex:
terraform show -json "terraform.tfplan" | jq "." > "terraform.tfplan.json" # Output JSON Plan to scan for destroy changes
HAS_DESTROY_CHANGES=$(jq '[.resource_changes // []|.[]|{"address":.address,"actions":.change.actions[0]}|select(.actions=="delete")]|length>0' "terraform.tfplan.json")
Hope this helps or provides some further ideas
Right now a regex is ran to detect if any changes happen. Investigate if there would be a way to detect the changes in a less error prone way.
Ideas: scan plan output (can we output a separate plan output if user specified one?)