Skip to content

Instantly share code, notes, and snippets.

@nshenry03
Created February 14, 2019 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nshenry03/8ed6e799e61022c745082367975186ec to your computer and use it in GitHub Desktop.
Save nshenry03/8ed6e799e61022c745082367975186ec to your computer and use it in GitHub Desktop.
Assert that all outputs have resources and all resources have at least one output
diff -rupN \
<(
ack "^\s*resource\s*" main.tf \
| awk '{print $2"."$3}' \
| sed -e 's/"//g' \
| sort -u
) \
<(
ack "^\s*value\s*=" outputs.tf \
| ack -o '[({ ,]\w*\.\w*\.?' \
| sed -e 's/^[{( ,]//' -e 's/\.$//' \
| sort -u
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment