Utilize list comprehension to output EC2 ARNs.

This commit is contained in:
mharb 2023-10-23 15:11:46 -04:00
parent b927d6346a
commit 5ae1a3d752
3 changed files with 13 additions and 8 deletions

View File

@ -5,7 +5,7 @@
# filter {
# name = "name"
# values = var.compute_ami
# values = ["amazon linux"]
# }
# filter {
@ -18,3 +18,6 @@
# values = ["x86_64"]
# }
# }
# data "" "ec2_arns" {
# }

View File

@ -1,4 +1,5 @@
terraform {
required_version = ">= 0.13.1"
required_providers {
aws = {
source = "hashicorp/aws"

View File

@ -1,9 +1,10 @@
output "compute_ami" {
description = "Prints the image AMI installed on our EC2s."
value = data.aws_ami.compute_ami
}
# output "compute_ami" {
# description = "Prints the image AMI installed on our EC2s."
# value = data.aws_ami.compute_ami
# }
# Extract EC2 ARN from each instance, into a new map.
output "public_ec2" {
description = "Prints the ARN for the publicly accessible EC2"
value = module.standalone_ec2.arn
}
description = "Prints the ARN for the publicly accessible EC2(s)"
value = [for idx, val in module.standalone_ec2 : val.arn]
}