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
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
Parameters
-
arn
optional computed - string -
id
optional computed - string -
listener_arn
required - string -
priority
optional computed - number -
action
list block-
order
optional computed - number -
target_group_arn
optional - string -
type
required - string -
authenticate_cognito
list block-
authentication_request_extra_params
optional - map from string to string -
on_unauthenticated_request
optional computed - string -
scope
optional computed - string -
session_cookie_name
optional computed - string -
session_timeout
optional computed - number -
user_pool_arn
required - string -
user_pool_client_id
required - string -
user_pool_domain
required - string
-
-
authenticate_oidc
list block-
authentication_request_extra_params
optional - map from string to string -
authorization_endpoint
required - string -
client_id
required - string -
client_secret
required - string -
issuer
required - string -
on_unauthenticated_request
optional computed - string -
scope
optional computed - string -
session_cookie_name
optional computed - string -
session_timeout
optional computed - number -
token_endpoint
required - string -
user_info_endpoint
required - string
-
-
fixed_response
list block-
content_type
required - string -
message_body
optional - string -
status_code
optional computed - string
-
-
forward
list block-
stickiness
list block -
target_group
set block
-
-
redirect
list block
-
-
condition
set block-
host_header
list block-
values
required - set of string
-
-
http_header
list block-
http_header_name
required - string -
values
required - set of string
-
-
http_request_method
list block-
values
required - set of string
-
-
path_pattern
list block-
values
required - set of string
-
-
query_string
set block -
source_ip
list block-
values
required - set of string
-
-
Explanation in Terraform Registry
Provides a Load Balancer Listener Rule resource.
Note:
aws_alb_listener_rule
is known asaws_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
-
ListenerArn
required - String -
Actions
required - List of Action -
Priority
required - Integer -
Conditions
required - List of RuleCondition
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.