Tanu
Tanu

Reputation: 1612

How can I add domain names to my terraform configuration

I want to Add domain to listener rule in addition to paths. What arguments should I use for the same.

resource "aws_alb_listener_rule" "service" {
  listener_arn = var.alb_listener_arn
  action {
    type             = "forward"
    target_group_arn = aws_alb_target_group.service.arn
  }
  condition {
    path_pattern {
      values = ["/login", "/logout"]
    }
  }

Thank you.

Upvotes: 0

Views: 557

Answers (2)

Tanu
Tanu

Reputation: 1612

Thanks. This worked.

condition {
    path_pattern {
      values = ["/login", "/logout"]
    }
}
condition {
    host_header {
      values = ["my-service.*.terraform.io"]
    }
  }

Upvotes: 0

Marcin
Marcin

Reputation: 238081

The domain name is specified using host_header:

Contains a single values item which is a list of host header patterns to match.

An example usage from the docs:

  condition {
    host_header {
      values = ["my-service.*.terraform.io"]
    }
  }

Upvotes: 1

Related Questions