Data Source: aws_lb_listener

Provides information about a Load Balancer Listener.

This data source can prove useful when a module accepts an LB Listener as an input variable and needs to know the LB it is attached to, or other information specific to the listener in question.

Example Usage

# get listener from listener arn

variable "listener_arn" {
  type = "string"
}

data "aws_lb_listener" "listener" {
  arn = "${var.listener_arn}"
}

# get listener from load_balancer_arn and port

data "aws_lb" "selected" {
  name = "default-public"
}

data "aws_lb_listener" "selected443" {
  load_balancer_arn = "${data.aws_lb.selected.arn}"
  port = 443
}

Argument Reference

The following arguments are supported:

  • arn - (Optional) The arn of the listener. Required if load_balancer_arn and port is not set.
  • load_balancer_arn - (Optional) The arn of the load balander. Required if arn is not set.
  • port - (Optional) The port of the listener. Required if arn is not set.

Attributes Reference

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

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/d/lb_listener.html