Skip to content

Instantly share code, notes, and snippets.

View rquadling's full-sized avatar

Richard Quadling rquadling

  • Exeter, Devon, UK
View GitHub Profile
@rquadling
rquadling / tfdiags.md
Last active December 6, 2022 12:04
Display the diagnostics from Terraform in a tabular form

Terraform Diagnostics Display

As part of the upgrading from v3 to v4 of the Terraform AWS Provider, I needed to see all the places where I needed to do some work. The standard ouput from Terraform doesn't show all the places where work is required. But, luckily, using the -json option, you get access to all of the information.

The following shell script (written and tested in bash, but should be OK as really, it's only terraform, jq, column, and | that's being used) will output a nicely formatted table showing you the

@rquadling
rquadling / generate_cloudflare_state_changes.sh
Created April 17, 2025 13:09
Generate terraform state manipulations for the Terraform Cloudflare Provider upgrade from v4 to v5.
#!/usr/bin/env bash
# Check if arguments are provided (either tfvars files or default to terraform.tfvars)
TFVARS_FILES=("$@") # Collect arguments into an array
# If no arguments are provided, default to terraform.tfvars
if [ ${#TFVARS_FILES[@]} -eq 0 ]; then
TFVARS_FILES=("terraform.tfvars")
fi