【发布时间】:2020-10-06 17:09:19
【问题描述】:
我需要为 Azure 资源设置多个安全规则。
在 AWS 上,我可以做多个入口:
resource "aws_security_group" "mygroup" {
name = "mygroup"
ingress {
description = "allow all on ssh port"
from_port = var.ssh
to_port = var.ssh
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
description = "public port"
from_port = var.public
to_port = var.public
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
description = "restricted"
from_port = var.restricted
to_port = var.restricted
protocol = "tcp"
cidr_blocks = ["<restricted-ip>/32"]
}
但我不知道如何在 Azure 上执行此操作。
据我所知azurerm_network_security_group 只允许一个security_rule(这是正确的吗?)。
也许我可以为同一个network_interface_id 但不同的network_security_group_id 创建多个azurerm_network_interface_security_group_association?
【问题讨论】: