https://pulumi.com logo
Title
m

miniature-window-2464

12/14/2021, 1:09 PM
Hello, I tried to deploy an Azure subnet with delegations (the example here is not complete https://www.pulumi.com/registry/packages/azure-native/api-docs/network/subnet/#create-subnet-with-a-delegation) and I get this error when adding the delegations node: error: Code="InvalidRequestFormat" Message="Cannot parse the request." Details=[]. This is my code:
const appSubnet = new azure_native.network.Subnet("appSubnet", {
    addressPrefix: "10.1.2.0/24",
    resourceGroupName: resourceGroup.name,
    subnetName: "appSubnet",
    virtualNetworkName: myVirtualNetwork.name,
    delegations: [{
        serviceName : "Microsoft.ContainerInstance"
    }]
});
Any ideas of what is wrong? I want to delegate it to Container Instances service. Thank you, mauro
b

brave-planet-10645

12/14/2021, 2:14 PM
You need to give the delegation a name, so something like:
const appSubnet = new azure_native.network.Subnet("appSubnet", {
    addressPrefix: "10.1.2.0/24",
    resourceGroupName: resourceGroup.name,
    subnetName: "appSubnet",
    virtualNetworkName: myVirtualNetwork.name,
    delegations: [{
        serviceName : "Microsoft.ContainerInstance/containerGroups",
        name: "name-of-delegation"
    }]
});
Also, I think the service needs to be the full "type". So if you're using
containerGroups
it would look like my example above, with
Microsoft.ContainerInstance/containerGroups
m

miniature-window-2464

12/14/2021, 4:48 PM
Thank you very much. It works!