Terraform plan show resource names only

2024-06-12

Requirements

  • terraform
  • jq
# Dump terraform output to a file
terraform plan -out tfplan

# Show only the resource name and the action of those that will be updated or recreated
terraform show -json tfplan \
  | jq -r '.resource_changes[] | select (.change.actions | inside(["create","update","delete"])) |  [ .address, ( .change.actions | join(" ")) ] | @csv' \
  | sed -e "s/delete\screate/replace/g" -e "s/create\sdelete/replace/g"
Avatar
Janos Miko Fill your bucket by drop by drop.