aws_lb_listener
Provides a Load Balancer Listener resource.
Note:
aws_alb_listener
is known asaws_lb_listener
. The functionality is identical.
Example Usage
# 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" } }
Argument Reference
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 areTCP
,HTTP
andHTTPS
. Defaults toHTTP
. -
ssl_policy
- (Optional) The name of the SSL Policy for the listener. Required ifprotocol
isHTTPS
. -
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 theaws_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
HTTP
orHTTPS
protocols while listeners that are attached to Network Load Balancers must use theTCP
protocol.
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 isforward
.
Attributes Reference
The following attributes are exported in addition to the arguments listed above:
Import
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