-
Notifications
You must be signed in to change notification settings - Fork 0
/
outputs.tf
38 lines (31 loc) · 1.37 KB
/
outputs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#Terraform Output file
#Ec2 Instance Public IP address #Loop with list
output "instance_public_dns" {
description = "Instance public DNS"
value = [for instance in aws_instance.ec2vm: instance.public_dns ]
}
#Ec2 Instance Public DNS #splat *
output "instance_public_ip" {
description = "Instance public IP address"
value = [for instance in aws_instance.ec2vm: instance.public_ip ]
#value = aws_instance.ec2vm[*].public_ip
}
#value = [for instance in aws_instance.ec2vm.public_dns: instance.public_ip ] #Loop with list
#value = {for instance in aws_instance.ec2vm.public_dns: instance_id => instance.public_ip } #map
#value = [for instance in aws_instance.ec2vm.public_dns: instance_public_ip ] #list
# output "ec2-az0" {
# value = { for az, info in data.aws_ec2_instance_type_offerings.ins_type:
# az => info.instance_types }
# }
# output "ec2-az1" {
# value = { for az, info in data.aws_ec2_instance_type_offerings.ins_type:
# az => info.instance_types if length(info.instance_types) != 0}
# }
output "ec2-az2" {
value = keys({ for az, info in data.aws_ec2_instance_type_offerings.ins_type:
az => info.instance_types if length(info.instance_types) != 0})
}
# output "ec2-az3" {
# value = keys({ for az, info in data.aws_ec2_instance_type_offerings.ins_type:
# az => info.instance_types if length(info.instance_types) != 0})[1]
# }