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