2023-07-29 13:00:58 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
#%%MULTILINE_YAML_START
|
|
|
|
|
#Terraform plan
|
2024-06-29 09:00:38 -05:00
|
|
|
apk add --update curl jq
|
2023-07-29 13:00:58 +00:00
|
|
|
alias convert_report="jq -r '([.resource_changes[].change.actions?]|flatten)|{\"create\":(map(select(.==\"create\"))|length),\"update\":(map(select(.==\"update\"))|length),\"delete\":(map(select(.==\"delete\"))|length)}'"
|
2024-06-29 07:43:46 -05:00
|
|
|
tofu plan -out=$PLAN $ARGUMENTS
|
2024-06-29 09:00:38 -05:00
|
|
|
tofu show --json $PLAN | jq -r '([.resource_changes[].change.actions?]|flatten)|{"create":(map(select(.=="create"))|length),"update":(map(select(.=="update"))|length),"delete":(map(select(.=="delete"))|length)}' > $JSON_PLAN_FILE
|