Hello, I'm quite new to Pulumi, I've created on az...
# azure
b
Hello, I'm quite new to Pulumi, I've created on azure, a VNet with subnets and NSG attached to each subnet. The creation with pulumi up went fine. But, when I update my python code, in order to extend the VNet address space and add a subnet in the VNet: • the address space is correctly added to the VNet, • the new subnet is also added. • But all the other subnets have disappeared! All the subnets were empty (no VM or anything else running inside them). any though about this strange behaviour?
t
Did you declare any subnets as items in
subnets
property of the virtual network resource? Or were they all separate resources?
b
They are separated resource with opts=ResourceOptions(parent=vnet)
t
That’s weird then… Any chance you could submit a simple repro?
b
I could try to reduce it to simple code to reproduce it then. I'll post asap. Currently involved in a Hackathon until Thursday. Thanks for your prompt answers. That's much appreciated
e
Any reason why you needed to declare opts=ResourceOptions(parent=vnet)? I'm also using python to create subnets as separate resources and am just relying on virtual_network_name=vnet for the association. Haven't had any subnets disappear although I also haven't added any address spaces to the vnet after subnet creation. I have noticed in the Azure Portal though that you can't add an address space to a vnet after a peering is established - does this apply in your situation?
Mind you, looking at the Azure Activity Log I see retryable errors creating the subnets while the vnet is being updated by a Peering being created in parallel:
"statusMessage": "{\"error\":{\"code\":\"RetryableError\",\"message\":\"A retryable error occurred.\",\"details\":[{\"code\":\"RetryableErrorDueToAnotherOperation\",\"message\":\"Operation PutVirtualNetworkPeeringOperation (1979b777-a99a-4223-b9fb-f58a1b04be9b) is updating resource /subscriptions/e2442e38-cf1a-47bb-9110-7e022052f875/resourceGroups/vdc-rg-c614683e/providers/Microsoft.Network/virtualNetworks/hub-vn-09ebf933. The call can be retried in 14 seconds.\"}]}}"
b
Azure was in heavy pressure, yesterday. We had even regular outage. I discussed with Microsoft, and using ARM Template, we got the same issue: In fact, subnets are deleted if subnets are defined outside the VNet (as separated resources). But, when defined inside the VNet it works correctly. And sure, the VNet has no peering to be able to extend the address space. Here is a link about this subnet issue: https://github.com/Azure/azure-quickstart-templates/issues/2786#issuecomment-519630450 I didn't get the chance yet to check it with Pulumi. We'll do asap.
e
Thats interesting, the suggestion https://github.com/Azure/azure-quickstart-templates/issues/2786#issuecomment-585200802 that it doesn't have to be either/or but you can declare the same subnets within the vnet and as separate resources - I may give that a try. I needed to use separate resources so I could associate route tables etc.
b
I have tried to create the subnets inside the VirtualNetwork, and it's working this way. But as James mentioned, I don't know how to add route table then.
e
Hi Sylvain, I think this is related to the discussion in https://pulumi-community.slack.com/archives/CRVK66N5U/p1585637378036500. The main points: 1. don't use inline subnets 2. pulumi refresh before update. Cheers, James