Multiple address prefixes in network security group

I want to define multiple address prefixes in the source or destination prefixes when adding a rule in a NSG. When I try to apply this, I get an Azure API error. What is the correct syntax to use ?

resource “azurerm_network_security_group” “nsg-test” {

name = “nsg-test”

location = var.region

resource_group_name = azurerm_resource_group.rg-test.name

security_rule {

name                       = "AllowSSHIn"

priority                   = 100

direction                  = "Inbound"

access                     = "Allow"

protocol                   = "Tcp"

source_port_range          = "*"

destination_port_range     = "22"

source_address_prefix      = "10.100.0.0/16,10.79.0.0/16"

destination_address_prefix = "*"

}
}

Error I get when applying :

AllowSSHIn has invalid Address prefix. Value provided: 10.100.0.0/16,10.79.0.0/16"

Hi,

Probably, you should try to use source_address_prefixes argument of security_rule block instead of source_address_prefix.
source_address_prefixes argument supports list of address prefixes.

Thanks !

Indeed, just need to use source_address_prefixes instead of source_address_prefix

source_address_prefixes = [ “10.79.0.0/16” , “10.100.0.0/16” ]

Problem solved

Do you know how I could accomplish this with csvdecode(file(

When I try and parse the following
source_address_prefixes = [
+ "“10.1.0.0/16”,“10.128.0.0/9”,“10.16.0.0/12”,“10.2.0.0/15”,“10.32.0.0/11”,"10.4.0.0/14,"10.64.0.0/10,“10.8.0.0/13"”,
]
I get SecurityRuleInvalidAddressPrefix