So I have some Subnets built and a SecurityGroup. ...
# typescript
p
So I have some Subnets built and a SecurityGroup. I dont see anywhere in the docs for NSG stating how you go about attaching this to a subnet. Here is my code so far
Copy code
const USNetWork = new azure_native.network.VirtualNetwork(usNetName, {
    resourceGroupName: RG,
    location: "WestUS",
    virtualNetworkName: usNetName,
    addressSpace: {
        addressPrefixes: [usAddr],
    },

});

const domainSubnetUSA = new azure_native.network.Subnet(usADDSSubnetName, {
    resourceGroupName: RG,
    subnetName: usADDSSubnetName,
    virtualNetworkName: USNetWork.name,
    addressPrefix: usADDSSubnetaddr,
  });

  const meshSubnetUSA = new azure_native.network.Subnet(usMESHSubnetName, {
    resourceGroupName: RG,
    subnetName: usMESHSubnetName,
    virtualNetworkName: USNetWork.name,
    addressPrefix: usMESHSubnetaddr,
  });

  const InboundSGUSA = new azure_native.network.NetworkSecurityGroup("InboundSG", {
    location: "WestUS",
    networkSecurityGroupName: "Test",
    resourceGroupName: RG,
    securityRules: [allowPSRM,allowRDP],
});
l
Does
meshSubnetUSA.networkSecurityGroup = InboudSGUSA
work?
p
It looks like subnet.networkSecurityGroup is readOnly.
Subnet.networkSecurityGroup: pulumi.Output<azure_native.types.output.network.NetworkSecurityGroupResponse
so it wont let me do that no.
I just looked through github to see how others are doing it and I dont see them attaching them to anything. People are just making the SG and thats it
c
Here is an example: azure-networksg-ts
p
Thanks a lot Tushar