Can I somehow get to the `id` property of the nest...
# general
c
Can I somehow get to the
id
property of the nested subnet resource of an Azure vnet?
Copy code
const vnet = new azure.network.VirtualNetwork("vnet", {
    resourceGroupName: resourceGroup.name,
    location: region,
    name: "vnet",
    addressSpaces: [addressSpace],
    subnets: [
        {
            addressPrefix: addressPrefix1,
            name: "management"
        }
    ]
})
Creating a subnet like this is allowed, but I wonder if I need to actually get to any information about this subnet in the same stack if it would be better to use the Subnet resource, instead of this nested syntax here. Or is there a way to get to that nested resource?
w
I believe you can get it with:
Copy code
vnet.subnets[0].id
c
yes, that works, however, ideally I'd like to run a
.filter()
on
vnet.subnets
to find the correct subnet by name. That doesn't seem to work though with a type error.
I worked around this by moving the vnet creation into a component and outputting each subnet, that way I can now do
vnet.mgmtSubnet
for example