https://pulumi.com logo
Title
o

orange-dog-73995

10/05/2020, 12:20 PM
And another question on NSG - how should we tie subnets to it in NextGen? Before it was like:
new SubnetNetworkSecurityGroupAssociation("assc1", new SubnetNetworkSecurityGroupAssociationArgs
        {             NetworkSecurityGroupId = nsg.Id,             SubnetId = Subnet1.Id         });
t

tall-librarian-49374

10/05/2020, 12:25 PM
Subnet
has a
NetworkSecurityGroup
property. You set its
Id
to the NSG ID.
o

orange-dog-73995

10/05/2020, 1:36 PM
and it became even more complicated 🙂 as it wants not an Id anymore:
var subnet1 = new Subnet("domain", new Pulumi.AzureNextGen.Network.Latest.SubnetArgs
        {             ResourceGroupName = _resourceGroup.Name,             VirtualNetworkName = network.Name,             AddressPrefixes = "10.10.1.0/24",             NetworkSecurityGroup = _nsg,                     });
VSCode says on _nsg: Cannot implicitly convert type 'Pulumi.AzureNextGen.Network.Latest.NetworkSecurityGroup' to 'Pulumi.Input<Pulumi.AzureNextGen.Network.Latest.Inputs.NetworkSecurityGroupArgs>'
t

tall-librarian-49374

10/05/2020, 1:44 PM
It does want an Id inside an args class, and it tells you so 😉
var subnet1 = new Subnet("domain", new Pulumi.AzureNextGen.Network.Latest.SubnetArgs
{
    ResourceGroupName = _resourceGroup.Name,
    VirtualNetworkName = network.Name,
    AddressPrefixes = "10.10.1.0/24",
    NetworkSecurityGroup = new NetworkSecurityGroupArgs
    {
        Id = nsg.Id
    },            
});
o

orange-dog-73995

10/05/2020, 1:45 PM
oh, I see now..
t

tall-librarian-49374

10/05/2020, 1:45 PM
Mind that
NetworkSecurityGroupArgs
is from the
Inputs
namespace
o

orange-dog-73995

10/05/2020, 1:50 PM
yes, thanks for noting this. Moving to LB config 🙂