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,
});No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by