pulumi-azure
pulumi-azure copied to clipboard
Associate Network Security Group to subnet during subnet creation
This is more like feature request, rather than a bug.
My client has an Azure Policy that prevents creation of subnets without Network Security Group (further nsg) assigned to it. As of now, using Pulumi I need to create nsg, then create subnet and then use SubnetNetworkSecurityGroupAssociation
to assign nsg to subnet.
What would be really nice is to have a possibility to assign NSG to subnet during creation of the subnet. Something like
var rg = new ResourceGroup("rg", ...);
var vnet = new VirtualNetwork("vnet", ...);
var nsg = new NetworkSecurityGroup("subnet", ...);
var subnet = new Subnet("subnet", new SubnetArgs
{
ResourceGroupName = rg.Name,
VirtualNetworkName = vnet.Name,
AddressPrefix = "10.0.2.0/24",
NetworkSecurityGroupId = nsg.Id // <---- this doesn't exists today :)
});