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
# Outputs ======================================================================

output "id" {
  description = "Load balancer ID."
  value       = aws_lb.this.id
}

output "arn" {
  description = "Load balancer ARN."
  value       = aws_lb.this.arn
}

output "name" {
  description = "Generated load balancer name."
  value       = aws_lb.this.name
}

output "dns_name" {
  description = "DNS name of the load balancer."
  value       = aws_lb.this.dns_name
}

output "zone_id" {
  description = "Hosted zone ID of the load balancer (for Route53 alias records)."
  value       = aws_lb.this.zone_id
}

output "target_group_arns" {
  description = "Map of target group logical key to ARN."
  value       = { for k, v in aws_lb_target_group.this : k => v.arn }
}

output "target_group_names" {
  description = "Map of target group logical key to generated name."
  value       = local.target_group_names
}

output "listener_arns" {
  description = "Map of listener logical key to ARN."
  value       = { for k, v in aws_lb_listener.this : k => v.arn }
}

output "target_group_health_checks" {
  description = "Map of target group logical key to its resolved health check config, for troubleshooting unhealthy targets without opening the console."
  value = {
    for k, v in var.target_groups :
    k => v.health_check
  }
}

output "target_attachment_ids" {
  description = "Map of flattened attachment key (target_group_key-target_key) to the target_id that was attached."
  value       = { for k, v in aws_lb_target_group_attachment.this : k => v.target_id }
}