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
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Outputs ======================================================================

output "id" {
  description = "VPC ID"
  value       = aws_vpc.this.id
}

output "arn" {
  description = "VPC ARN"
  value       = aws_vpc.this.arn
}

output "cidr_block" {
  description = "Primary VPC CIDR block"
  value       = aws_vpc.this.cidr_block
}

output "secondary_cidr_blocks" {
  description = "List of secondary CIDR blocks associated with the VPC"
  value       = [for assoc in aws_vpc_ipv4_cidr_block_association.this : assoc.cidr_block]
}

output "public_subnet_ids" {
  description = "Map of public subnet logical key to subnet ID"
  value       = { for k, v in aws_subnet.public : k => v.id }
}

output "private_subnet_ids" {
  description = "Map of private subnet logical key to subnet ID"
  value       = { for k, v in aws_subnet.private : k => v.id }
}

output "isolated_subnet_ids" {
  description = "Map of isolated subnet logical key to subnet ID"
  value       = { for k, v in aws_subnet.isolated : k => v.id }
}

output "public_subnet_arns" {
  description = "Map of public subnet logical key to subnet ARN"
  value       = { for k, v in aws_subnet.public : k => v.arn }
}

output "private_subnet_arns" {
  description = "Map of private subnet logical key to subnet ARN"
  value       = { for k, v in aws_subnet.private : k => v.arn }
}

output "isolated_subnet_arns" {
  description = "Map of isolated subnet logical key to subnet ARN"
  value       = { for k, v in aws_subnet.isolated : k => v.arn }
}

output "public_subnet_id_list" {
  description = "Flat list of public subnet IDs"
  value       = values({ for k, v in aws_subnet.public : k => v.id })
}

output "private_subnet_id_list" {
  description = "Flat list of private subnet IDs"
  value       = values({ for k, v in aws_subnet.private : k => v.id })
}

output "isolated_subnet_id_list" {
  description = "Flat list of isolated subnet IDs"
  value       = values({ for k, v in aws_subnet.isolated : k => v.id })
}

output "public_subnet_arn_list" {
  description = "Flat list of public subnet ARNs"
  value       = values({ for k, v in aws_subnet.public : k => v.arn })
}

output "private_subnet_arn_list" {
  description = "Flat list of private subnet ARNs"
  value       = values({ for k, v in aws_subnet.private : k => v.arn })
}

output "isolated_subnet_arn_list" {
  description = "Flat list of isolated subnet ARNs"
  value       = values({ for k, v in aws_subnet.isolated : k => v.arn })
}

output "nat_gateway_ids" {
  description = "Map of NAT gateway key to NAT gateway ID"
  value       = { for k, v in aws_nat_gateway.this : k => v.id }
}

output "internet_gateway_id" {
  description = "Internet gateway ID (null when no public subnets)"
  value       = length(aws_internet_gateway.this) > 0 ? aws_internet_gateway.this["igw"].id : null
}

output "private_route_table_ids" {
  description = "Map of private subnet key to route table ID"
  value       = { for k, v in aws_route_table.private : k => v.id }
}

output "isolated_route_table_ids" {
  description = "Map of isolated subnet key to route table ID"
  value       = { for k, v in aws_route_table.isolated : k => v.id }
}

output "public_route_table_id" {
  description = "Public route table ID (null when no public subnets)"
  value       = length(aws_route_table.public) > 0 ? aws_route_table.public["public"].id : null
}

output "tgw_attachment_id" {
  description = "TGW VPC attachment ID, null when transit_gateway_id is not set"
  value       = length(aws_ec2_transit_gateway_vpc_attachment.this) > 0 ? aws_ec2_transit_gateway_vpc_attachment.this[0].id : null
}

output "tgw_attachment_arn" {
  description = "TGW VPC attachment ARN, null when transit_gateway_id is not set"
  value       = length(aws_ec2_transit_gateway_vpc_attachment.this) > 0 ? aws_ec2_transit_gateway_vpc_attachment.this[0].arn : null
}