The <azure-native version guide> says that you can...
# azure
f
The azure-native version guide says that you can "switch between different API versions of a given resource, including to and from its top-level default representation, whenever you want". However, when I create a new resource using a specific version, it is created with a URN that contains the version name (i.e. v20230201). When I then change to use the default version and run pulumi up, the preview fails, because it wants to delete the version specific instance and create a new instance (the preview failure is due to the use of the protect flag on the original instance). How can I switch between different API versions without Pulumi indicating that it is going to delete and recreate?
a
Can you share which resource you are having problems with (and which version) as well as the version of pulumi-azure-native that you are using?
a
I'm having the same issue!
b
we think this is a bug, but if ya could give us more deets about what resource ur hitting this with it would be helpful. also the azure native version ur on.
a
I asked my question in general @brainy-church-78120. The issue, I have, is with AKS, but we are looking at the way we use the AKS resource in a component resource and I think we will just remove the component resource, it is useless and it is adding up to our resource count ($)
f
These are the current versions I'm using, although I noticed this problem when I first started using Pulumi 1-2 months ago on slightly older versions and just ignored it at the time. • Pulumi 3.54.1 • Pulumi.AzureNative 1.100.0 • Pulumi CLI: 3.63.0 The specific resource I'm trying to create is a Databricks Workspace, switching between Pulumi.AzureNative.Databricks.V20230201 and Pulumi.AzureNative.Databricks. I need V20230201 due to the newer properties such as PublicNetworkAccess, but since I had encountered the version switch problem when I first started using Pulumi, I wanted to see if it was still an issue. The Pulumi Azure Native Resource is wrapped/created-by a custom resource. Here is the URN that was created that contains the API version.
"urn": "urn:pulumi:Prod01::CompanyName.Iac.Azure.Trm.Dw::CompanyNam:Azure:Databricks:Workspace$azure-native:databricks/v20230201:Workspace::companyname-trm-prod01-un1-dtbws-auth-01",
When I removed the version specific namespace, it want's to delete and recreate (see screen shot). The preview failed because the original resource is protected.
a
Thanks for the additional information. This definitely looks like a bug to me. I opened an issue in pulumi-azure-native: Unable to migrate resource between versions #2397.
t
@fast-belgium-1399 A couple of questions to triage this: is your resource defined inside a component resource? Do you have the
Parent
option set on it?
The alias seems to be there, but I guess it goes wrong somewhere else https://github.com/pulumi/pulumi-azure-native/blob/master/sdk/dotnet/Databricks/Workspace.cs#L143
f
Yes, the Pulumi Azure Native Databricks resource is defined inside my component resource. The databricks resource does have the parent property set to my component resource as well.