Created
March 29, 2022 11:47
-
-
Save khaliqgant/22a613818f0d00fea04727b4cf26c967 to your computer and use it in GitHub Desktop.
[Terraform Output] Output from for_each #terraform #infrastructure
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
# object | |
output "repo_ids" { | |
value = { | |
for idx,repo in aws_ecr_repository.repo : idx => repo.registry_id | |
} | |
} | |
# list | |
output elastic_ips { | |
value = [for eip in aws_eip.eip : eip.id] | |
} | |
# source https://www.reddit.com/r/Terraform/comments/f4nr7v/how_do_you_capture_the_output_of_subnet_id_from_a/ | |
https://www.hashicorp.com/blog/hashicorp-terraform-0-12-preview-for-and-for-each | |
# https://stackoverflow.com/questions/60717236/how-to-define-a-list-of-output-when-using-list-and-for-each-in-terraform |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment