Skip to content

Instantly share code, notes, and snippets.

@markround
Created March 14, 2018 17:12
Show Gist options
  • Save markround/c32580ac8df94af8381b0c786cdd83bc to your computer and use it in GitHub Desktop.
Save markround/c32580ac8df94af8381b0c786cdd83bc to your computer and use it in GitHub Desktop.
Terraform outputs to env vars
eval $(terraform output -json \
| jq 'map_values(.value)' \
| jq -r 'keys[] as $k | "\($k)='"'"'\(.[$k])'"'"'"' \
| awk -F"=" '{l = $0; sub($1, "", l); print "export "toupper($1) l}'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment