proud-appointment-22284
10/27/2021, 6:56 PMI want to take the subnets part outside of the virtualnetwork resource but the pulumi is not able to handle such extractions, so I end up with this configuration. const VirtualNetwork = new network.VirtualNetwork("VirtualNetwork-test", {
addressSpace: {
addressPrefixes: ["10.49.184.0/23"],
},
enableDdosProtection: false,
location: "westeurope",
resourceGroupName: "rsg-network",
subnets: [{
addressPrefix: "10.49.185.0/27",
name: "subnet-test",
privateEndpointNetworkPolicies: "Enabled",
privateLinkServiceNetworkPolicies: "Enabled",
type: "Microsoft.Network/virtualNetworks/subnets",
}],
virtualNetworkName: "VirtualNetwork-test",
},);
const subnet = new network.Subnet("subnet-test", {
addressPrefix: "10.49.185.0/27",
name: "subnet-test",
privateEndpointNetworkPolicies: "Enabled",
privateLinkServiceNetworkPolicies: "Enabled",
resourceGroupName: "rsg-network",
subnetName: "subnet-test",
type: "Microsoft.Network/virtualNetworks/subnets",
virtualNetworkName: "VirtualNetwork-test",
}, {
parent: VirtualNetwork,
});
My goal is to achieve that the subnets part information would be just removed from the virtaulnetwork resource and I will have only standalone subnet resource, so the code should look like: const VirtualNetwork = new network.VirtualNetwork("VirtualNetwork-test", {
addressSpace: {
addressPrefixes: ["10.49.184.0/23"],
},
enableDdosProtection: false,
location: "westeurope",
resourceGroupName: "rsg-network",
virtualNetworkName: "VirtualNetwork-test",
},);
const subnet = new network.Subnet("subnet-test", {
addressPrefix: "10.49.185.0/27",
name: "subnet-test",
privateEndpointNetworkPolicies: "Enabled",
privateLinkServiceNetworkPolicies: "Enabled",
resourceGroupName: "rsg-network",
subnetName: "subnet-test",
type: "Microsoft.Network/virtualNetworks/subnets",
virtualNetworkName: "VirtualNetwork-test",
}, {
parent: VirtualNetwork,
});