Created
June 15, 2018 02:36
-
-
Save nitrocode/b9e59eb852a47d260df910dcabdb7fdb to your computer and use it in GitHub Desktop.
tfa will read the terraform.tfstate file and print out all the attributes of a resource
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Usage: tfa aws_instance.demo | |
| # Depends on jq | |
| # Must be run in a directory where the json terraform.tfstate file exists | |
| function tfa () { | |
| cat terraform.tfstate | jq ".modules[0].resources.\"$1\".primary.attributes"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment