https://pulumi.com logo
Title
f

fierce-dinner-64337

11/20/2022, 11:07 AM
Issues with Azure API Management. Language used c#. I've started with a brand new Azure subscription. There is nothing exotic on that environment. I'm using my personal Azure subscriptions for a PoC. Resource Groups and App insight works. Pulumi Up/destroy all good. The issue is when I add APIM. APIM services and APIM api's don't work. It either takes forever to create APIM or it says it fails but I can see a Resource APIM been created with Status "Activating". Now when I try to do Pulumi destroy, it get's stuck , it can't even delete Resource groups because there is APIM added to it ( even though the previous step has told me that it was unable to create APIM). What I do is Delete stack as well, and then I manually clean up everything. I have done this vicious thing 10 times!! Pulumi Up and Destroy don't seem to be working right when APIM and related services are added. I will try today with something else like CosmosDB.. I'm afraid to touch AKS after this!! I use the scripts I found in https://www.pulumi.com/registry/packages/azure/api-docs/apimanagement/api/ Not sure what's wrong with APIM. Any ideas?
h

high-byte-22536

11/20/2022, 1:42 PM
I recently ran into the same issue, after a bit of research I discovered APIM takes 40+ minutes to fully create the instance 🤯 More than likely if you wait for it Pulumi to finish it will eventually work!
f

fierce-dinner-64337

11/20/2022, 1:50 PM
But that's not happening when using simply terraform and I'm not implying anything against pulumi which is obviously great that's why we are here but I didn't expect it. It takes time for anything other than Resource groups and app insights!
h

high-byte-22536

11/20/2022, 1:57 PM
Hmm interesting, in my case I actually also tried with terraform and had the same problem, APIM taking 40 minutes to provision. You could always try creating the resources manually in the Azure console to see if it's something with the code or if the specific resources you're using happen to be ones that take a long time. I suspect Cosmos would also be one that takes a long time, but don't know for sure
c

colossal-plastic-81954

11/21/2022, 10:39 AM
Yeah, APIM takes very long. Creating the resource is not so bad, but activating it is sometimes an hour. I guess Terraform just creates it, but doesn't wait until it's activated like Pulumi does. I would prefer to have an option that would allow me to specify if you want to wait for the Activated state.
f

fierce-dinner-64337

11/21/2022, 11:17 AM
I'm little confused.. So what happens when in ci/cd? it will wait for an hour?!!
c

colossal-plastic-81954

11/21/2022, 11:18 AM
Yes
f

fierce-dinner-64337

11/21/2022, 11:18 AM
wow.. that feels like going on a first date and come back disappointed
c

colossal-plastic-81954

11/21/2022, 11:19 AM
I've noticed this only with APIM by the way. But I'd submit a feature request. To me, it also doesn't make sense to wait until it's activated.
f

fierce-dinner-64337

11/21/2022, 11:21 AM
i've done this over the weekend. My goal was AKS but I started from basics i.e resource groups, app insights and then APIM. Because it waits that long, some times it complains about Auth session and token.. I can say that there are few problems with this. I tried Cosmos. Cosmos is not bad but it took 25 mins.
I was very excited to break away from terraform but now I'm dubious tbh..
c

colossal-plastic-81954

11/21/2022, 11:22 AM
Don't. Pulumi is awesome.
Most of the time taken is actually by Azure, not by Pulumi.
f

fierce-dinner-64337

11/21/2022, 1:08 PM
ok, well an interesting task will be to configure both and produce metrics. If its faster with TF then its not the provider.
s

stocky-restaurant-98004

11/22/2022, 4:15 PM
@fierce-dinner-64337 It's worth noting that there are 2 Azure Pulumi providers: • Azure Classic wraps the TF provider in order to formulate the API calls to Azure. • Azure Native is built automatically from Azure's published OpenAPI (or similar) specs. If you're finding that Azure Classic is provisioning APIM with the desired speed, feel free to mix providers and provision APIM with Azure Classic and the rest of your resources with Azure Native. But also file an issue in Azure Native regardless - there may be something we can do to speed it up, or there might not because of the backend API, but we can look into it.
That said, Azure Native should be your default choice.
f

fierce-dinner-64337

11/22/2022, 5:36 PM
Thanks. My team was just concluding a meeting on this one. It's good to have seen your update.