Skip to content

Instantly share code, notes, and snippets.

@riweston
Last active September 14, 2021 16:43
Show Gist options
  • Save riweston/24d8ccee376b95ed1a6a99f8ac326c53 to your computer and use it in GitHub Desktop.
Save riweston/24d8ccee376b95ed1a6a99f8ac326c53 to your computer and use it in GitHub Desktop.
Terraform

State

Imports

jq

Snippet to output module objects and resource IDs

.resources[] | select(.module != null) | .module + "." + .type + "." + .name + " " + .instances[].attributes.id

Snippet to output resources and resource IDs

.resources[] | select((.module == null) and (.mode == "managed")) |  .type + "." + .name + " " + .instances[].attributes.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment