Creates an AWS VPC Lattice Listener Rule that routes traffic based on HTTP header and path matches to multiple target groups with different weights.

Terraform Template

resource "aws_vpclattice_listener_rule" "test" {
  listener_identifier = "aws_vpclattice_listener.example.listener_id"

  match {

    http_match {

      header_matches {
        case_sensitive = false

        match {
          exact = "example-contains"
        }
        name = "example-header"
      }

      path_match {
        case_sensitive = true

        match {
          prefix = "/example-path"
        }
      }
    }
  }
  name = "example"
  priority = 20
  service_identifier = "aws_vpclattice_service.example.id"
}