Utilize list comprehension to output EC2 ARNs.
This commit is contained in:
parent
b927d6346a
commit
5ae1a3d752
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
# filter {
|
# filter {
|
||||||
# name = "name"
|
# name = "name"
|
||||||
# values = var.compute_ami
|
# values = ["amazon linux"]
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# filter {
|
# filter {
|
||||||
|
@ -18,3 +18,6 @@
|
||||||
# values = ["x86_64"]
|
# values = ["x86_64"]
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
# data "" "ec2_arns" {
|
||||||
|
# }
|
|
@ -1,4 +1,5 @@
|
||||||
terraform {
|
terraform {
|
||||||
|
required_version = ">= 0.13.1"
|
||||||
required_providers {
|
required_providers {
|
||||||
aws = {
|
aws = {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
output "compute_ami" {
|
# output "compute_ami" {
|
||||||
description = "Prints the image AMI installed on our EC2s."
|
# description = "Prints the image AMI installed on our EC2s."
|
||||||
value = data.aws_ami.compute_ami
|
# value = data.aws_ami.compute_ami
|
||||||
}
|
# }
|
||||||
|
|
||||||
|
# Extract EC2 ARN from each instance, into a new map.
|
||||||
output "public_ec2" {
|
output "public_ec2" {
|
||||||
description = "Prints the ARN for the publicly accessible EC2"
|
description = "Prints the ARN for the publicly accessible EC2(s)"
|
||||||
value = module.standalone_ec2.arn
|
value = [for idx, val in module.standalone_ec2 : val.arn]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user