Hi, I have following problem with Pulumi: Last y...
# azure
Hi, I have following problem with Pulumi: Last year I created a database account using API V20221115 since I needed few properties which were available only in this API, now I want to upgrade to the latest provider, but the problem is that the object ids in the Pulumi state contains the API versions like:
If I switch the API to latest the URN of the object is changed to the
which results that Pulumi wants to drop and recreate my database which I don't want 🙂 ( of course object is protected so the drop fails ) . What is the best approach in this situation? Maybe I can manually rename the urn without dropping the database or do a backup, recreate and then restore of the data ?
Hmm, in theory, this should not happen since we have aliases between same resources of different API versions
Any chance you are changing anything else in addition to the API version? Maybe resource parent or name?
You can use the
resource option to point the new resource to the old urn, which should get you unblocked: https://www.pulumi.com/docs/concepts/options/aliases/ But again, this should not be required...
Thanks I will try and write back.
So from the logs it looks like the provider is changed since I'm switching from Pulumi.AzureNative v1 to v2
Copy code
12:42:08 [DBG] azure-native:documentdb:DatabaseAccount cosmosdb  [diff: ~provider]
12:42:08 [DBG] azure-native:documentdb:SqlResourceSqlRoleDefinition cosmosdb/79e77441-c1be-4ebb-b79e-ba50a15150a4  [diff: ~provider]
12:42:08 [DBG] azure-native:documentdb:SqlResourceSqlDatabase cosmosdb/Database  [diff: ~provider]
which results to try to drop from source perspective the change is
Copy code
- using Pulumi.AzureNative.DocumentDB.V20221115;
- using Pulumi.AzureNative.DocumentDB.V20221115.Inputs;
+ using Pulumi.AzureNative.DocumentDB;
+ using Pulumi.AzureNative.DocumentDB.Inputs;
I will try to set aliases to the resources and write if it is working.
So setting Aliases property worked. Thanks a lot.
hi guys, I seem to have the same problem (as I've also moved from AzureNative 1.* to 2.* but with Network peerings. tried to add the alias but no luck, probably not doing it right? any help you can provide?
seems to happen on refresh only..
@rhythmic-activity-46295 Any reason you are using that specific
version? It was probably removed from v2 to save space, but any later version of the default one should work.
we were using it back in 2022 as it did have what we needed at the time, and trying to upgrade it now.. using the default.
this seems to happen on refresh only. we do a refresh on our pipelines before preview and update... locally can run preview and probably update without issues..
the stack json shows this:
I'm not sure how it can work on preview/update if the resource type doesn't exist anymore... My expectation is that your program should fail to compile.
preview works...
as it probably does not refer back to what is setup in the stack but rather uses the newer azurenative assembly as guide?!
the refresh has to look back to what's in the stack I take?!
not sure if the update would fail to be honest as I've not tried it yet...
this is what I get in detail when trying to do pulumi up:
Ah, so you updated your code but haven't run
yet. I'm not sure what is going on with refresh, but if you run
once it should update the versions in state and fix the refresh.
that is what I suspect but is kind of a catch 22. insofar as I run refresh in the pipeline before preview or up..
will skip the refresh and see how it goes