AWS Elastic Load Balancing V2 Listener Rule

This page shows how to write Terraform and CloudFormation for Elastic Load Balancing V2 Listener Rule and write them securely.

aws_lb_listener_rule (Terraform)

The Listener Rule in Elastic Load Balancing V2 can be configured in Terraform with the resource name aws_lb_listener_rule. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

0122-alb-ingress.tf#L49
resource "aws_lb_listener_rule" "unauthenticated_paths" {
  count = module.this.enabled && length(var.unauthenticated_paths) > 0 && length(var.unauthenticated_hosts) == 0 ? length(var.unauthenticated_listener_arns) : 0

  listener_arn = var.unauthenticated_listener_arns[count.index]
  priority     = var.unauthenticated_priority > 0 ? var.unauthenticated_priority + count.index : null

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a Load Balancer Listener Rule resource.

Note: aws_alb_listener_rule is known as aws_lb_listener_rule. The functionality is identical.

AWS::ElasticLoadBalancingV2::ListenerRule (CloudFormation)

The ListenerRule in ElasticLoadBalancingV2 can be configured in CloudFormation with the resource name AWS::ElasticLoadBalancingV2::ListenerRule. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

Specifies a listener rule. The listener must be associated with an Application Load Balancer. Each rule consists of a priority, one or more actions, and one or more conditions.

Frequently asked questions

What is AWS Elastic Load Balancing V2 Listener Rule?

AWS Elastic Load Balancing V2 Listener Rule is a resource for Elastic Load Balancing V2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Elastic Load Balancing V2 Listener Rule?

For Terraform, the matkovskiy/tf-modules source code example is useful. See the Terraform Example section for further details.