Skip to content

bryan-rhm/terraform-aws-alb-listener-rule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform AWS Load Balancer Listener Rule module

Basic usage example

Forward listener rule

module "alb-listener-rule" {
  source       = "github.com/bryan-rhm/terraform-aws-alb-listener-rule?ref=v1.0.0"
  listener_arn = "arn:aws:elasticloadbalancing:us-east-1:1234:listener/app/test"
  priority     = 100
  path_pattern = ["/*"]
  target_groups = [{
    arn = "arn:aws:elasticloadbalancing:us-east-1:1234:targetgroup/test1"
  }]
  query_strings = [{
    value = "user"
  }]
}

Weighted listener rule

module "alb-listener-rule" {
  source       = "github.com/bryan-rhm/terraform-aws-alb-listener-rule?ref=v1.0.0"
  listener_arn = "arn:aws:elasticloadbalancing:us-east-1:1234:listener/app/test"
  priority     = 100
  path_pattern = ["/*"]
  target_groups = [{
    arn    = "arn:aws:elasticloadbalancing:us-east-1:1234:targetgroup/test1"
    weight = 80
    }, {
    arn    = "arn:aws:elasticloadbalancing:us-east-1:1234:targetgroup/test2"
    weight = 20
  }]
}

Requirements

Name Version
terraform >= 1.3.0
aws >= 3.57.0

Providers

Name Version
aws 3.71.0

Modules

No modules.

Resources

Name Type
aws_lb_listener_rule.this resource

Inputs

Name Description Type Default Required
host_header List of host header patterns to match. The maximum size of each pattern is 128 characters. Comparison is case insensitive. Wildcard characters supported: * list(string) [] no
http_headers HTTP Header Blocks, name/values required
list(object({
name = string
values = list(string)
}))
[] no
http_request_method List of HTTP request methods or verbs to match. Maximum size is 40 characters. list(string) [] no
listener_arn The ARN of the listener to which to attach the rule. string n/a yes
oidc_config Open ID Connect Configuration
object({
authorization_endpoint = string
client_id = string
client_secret = string
issuer = string
token_endpoint = string
user_info_endpoint = string
scope = optional(string) # The set of user claims to be requested from the IdP.
})
null no
path_pattern List of path patterns to match against the request URL. Maximum size of each pattern is 128 characters. list(string) [] no
priority The priority for the rule between 1 and 50000. Leaving it unset will automatically set the rule with next available priority after currently existing highest rule number null no
query_strings Key/value of query strings pattern to match
list(object({
key = optional(string)
value = string
}))
[] no
source_ip List of source IP CIDR notations to match. You can use both IPv4 and IPv6 addresses. Wildcards are not supported. list(string) [] no
target_groups The ARN and weight of the target groups to attach to the rule.
list(object({
arn = string
weight = optional(number)
}))
n/a yes

Outputs

Name Description
output Listener rule attributes