使用 teraform 部署的 NSG 安全规则 azure 中源、源服务标签和目标字段的等效参数字段是什么

What is the equivalent argument field for source, source service tag and destination field in NSG security rules azure using teraform deployment

在源和目标列中,VirtualNetwork、AzureLoadBalancer 和 Internet 是服务标签,而不是 IP 地址。我如何使用 terraform 创建它?

我正在尝试使用 terraform 在 azure 上创建 NSG。在创建 nsg 安全规则字段(如源、源服务标签和目标字段)时,创建 nsg 是必需的。我如何使用 terraform 创建此字段?

您可以在 Argument Reference 中看到 source_address_prefixdestination_address_prefix。也可以使用“VirtualNetwork”、“AzureLoadBalancer”和“Internet”等标签。

例如,您只需在 source_address_prefixdestination_address_prefix 字段中添加特定的服务标签。

 # VirtualNetwork
   security_rule {
     name                       = "RDP"
     priority                   = 300
     direction                  = "Inbound"
     access                     = "Allow"
     protocol                   = "Tcp"
     source_port_range          = "*"
     destination_port_range     = "80"
     source_address_prefix      = "VirtualNetwork"
     destination_address_prefix = "VirtualNetwork"
   }
#AppService
     security_rule {
     name                       = "SQL"
     priority                   = 310
     direction                  = "Inbound"
     access                     = "Allow"
     protocol                   = "Tcp"
     source_port_range          = "*"
     destination_port_range     = "80"
     source_address_prefix      = "AppService"
     destination_address_prefix = "*"
   }

结果