Provides a Load Balancer Listener resource.
Note:
aws_alb_listeneris known asaws_lb_listener. The functionality is identical.
# Create a new load balancer
resource "aws_lb" "front_end" {
# ...
}
resource "aws_lb_target_group" "front_end" {
# ...
}
resource "aws_lb_listener" "front_end" {
load_balancer_arn = "${aws_lb.front_end.arn}"
port = "443"
protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-2015-05"
certificate_arn = "arn:aws:iam::187416307283:server-certificate/test_cert_rab3wuqwgja25ct3n4jdj2tzu4"
default_action {
target_group_arn = "${aws_lb_target_group.front_end.arn}"
type = "forward"
}
}
The following arguments are supported:
load_balancer_arn - (Required, Forces New Resource) The ARN of the load balancer. port - (Required) The port on which the load balancer is listening. protocol - (Optional) The protocol for connections from clients to the load balancer. Valid values are TCP, HTTP and HTTPS. Defaults to HTTP. ssl_policy - (Optional) The name of the SSL Policy for the listener. Required if protocol is HTTPS. certificate_arn - (Optional) The ARN of the default SSL server certificate. Exactly one certificate is required if the protocol is HTTPS. For adding additional SSL certificates, see the aws_lb_listener_certificate resource. default_action - (Required) An Action block. Action blocks are documented below. NOTE:: Please note that listeners that are attached to Application Load Balancers must use either
HTTPorHTTPSprotocols while listeners that are attached to Network Load Balancers must use theTCPprotocol.
Action Blocks (for default_action) support the following:
target_group_arn - (Required) The ARN of the Target Group to which to route traffic. type - (Required) The type of routing action. The only valid value is forward. The following attributes are exported in addition to the arguments listed above:
Listeners can be imported using their ARN, e.g.
$ terraform import aws_lb_listener.front_end arn:aws:elasticloadbalancing:us-west-2:187416307283:listener/app/front-end-alb/8e4497da625e2d8a/9ab28ade35828f96
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/lb_listener.html