Terraform aws_alb_listener_rule 与主机和路径条件 [英] Terraform aws_alb_listener_rule with host AND path conditions

查看:16
本文介绍了Terraform aws_alb_listener_rule 与主机和路径条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AWS ALB 支持基于在同一规则中匹配主机和路径条件的规则.

AWS ALB supports rules based on matching both host and path conditions in the same rule.

您还可以创建结合基于主机的路由和基于路径的路由的规则.

You can also create rules that combine host-based routing and path-based routing.

我检查了控制台,UI 确实允许在同一规则中选择主机和路径条件.

I've checked the console and the UI does indeed allow for selecting host and path conditions in the same rule.

Terraform aws_alb_listener_rule 似乎支持主机 OR 路径条件.

Terraform aws_alb_listener_rule seems to support host OR path conditions.

必须是基于路径的路由的路径模式或基于主机的路由的主机头的一个.

Must be one of path-pattern for path based routing or host-header for host based routing.

强调我的

有没有一种方法可以对 ALB 规则进行 Terraform,该规则仅在请求主机名和路径都符合某些条件时触发?

Is there a way to Terraform an ALB rule that only triggers when both the request hostname and path match some criteria?

推荐答案

您可以指定两个条件,这将导致两个条件的 AND:

You can specify two conditions, which results in an AND of the two conditions:

resource "aws_alb_listener_rule" "host_header_rule" {
  condition {
    field  = "host-header"
    values = ["some.host.name"]
  }
  condition {
    field  = "path-pattern"
    values = ["/some-path/*"]
  }
  # etc.
}

这篇关于Terraform aws_alb_listener_rule 与主机和路径条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆