Skip to content

Data Source: aws_lb#

~> Note aws_alb is known as aws_lb. The functionality is identical.

Provides information about a Load Balancer.

This data source can prove useful when a module accepts an LB as an input variable and needs to, for example, determine the security groups associated with it, etc.

Example Usage#

variable "lb_arn" {
  type    = string
  default = ""
}

variable "lb_name" {
  type    = string
  default = ""
}

data "aws_lb" "test" {
  arn  = var.lb_arn
  name = var.lb_name
}

Argument Reference#

The following arguments are supported:

  • arn - (Optional) The full ARN of the load balancer.
  • name - (Optional) The unique name of the load balancer.
  • tags - (Optional) A mapping of tags, each pair of which must exactly match a pair on the desired load balancer.

~> Note: When both arn and name are specified, arn takes precedence. tags has lowest precedence.

Attributes Reference#

See the LB Resource for details on the returned attributes - they are identical.