We’re trying to update from using `azure-native:db...
# azure
We’re trying to update from using
to using
, but this fails as Pulumi attempts to create new databases overwriting the existing ones. The azure-native documentation says that you can update API versions back and forth, and I see that our previous API version is listed as an alias in the new version of the provider (https://github.com/pulumi/pulumi-azure-native-sdk/blob/dbforpostgresql/v1.104.0/dbforpostgresql/v20221201/server.go#L105) Are there any obvious gotchas here?
Hi Morten! What version of the Azure Native provider are you using?
We are using v1.104.0 and trying to move to an API version which also exists in v2 so that we can migrate
can you share Pulumi’s diff when running
Copy code
jsonPayload: {
level: "debug"
caller: "services/platform/gollum/pkg/stack/stack.go:157"
message: "Updating (alert-service.dsj-alerts.azure-dev):

    pulumi:pulumi:Stack postgres-alert-service.dsj-alerts.azure-dev running 
    cognite:database:azure:Postgres dsj-alerts-alert-service  
    cognite:database:Instance dsj-alerts-alert-service  
@ updating....
    random:index:RandomPassword dsj-alerts-alert-service-postgresql-username-password  
    azure-native:resources:ResourceGroup dsj-alerts-alert-service-rg  
    azure-native:network:PrivateZone dsj-alerts-alert-service  
    azure-native:network:VirtualNetworkLink dsj-alerts-alert-service-defaultVnet  
@ updating.....
    random:index:RandomString dsj-alerts-alert-service-sa-suffix  
    azure-native:network:VirtualNetworkLink dsj-alerts-alert-service-aksVnet  
    azure-native:operationalinsights:Workspace dsj-alerts-alert-service  
    azure-native:storage:StorageAccount dsj-alerts-alert-service  
@ updating....
 +  azure-native:dbforpostgresql/v20221201:Server dsj-alerts-alert-service creating (0s) 
 +  azure-native:dbforpostgresql/v20221201:Server dsj-alerts-alert-service creating (0s) error: cannot create already existing subresource '/subscriptions/531564ca-ed4c-48b5-b4d0-6363b20c3aeb/resourceGroups/rg-postgresql-dsj-alerts-alert-service/providers/Microsoft.DBforPostgreSQL/flexibleServers/dsj-alerts-alert-service-azure-dev'
 +  azure-native:dbforpostgresql/v20221201:Server dsj-alerts-alert-service **creating failed** error: cannot create already existing subresource '/subscriptions/531564ca-ed4c-48b5-b4d0-6363b20c3aeb/resourceGroups/rg-postgresql-dsj-alerts-alert-service/providers/Microsoft.DBforPostgreSQL/flexibleServers/dsj-alerts-alert-service-azure-dev'
@ updating....
    pulumi:pulumi:Stack postgres-alert-service.dsj-alerts.azure-dev running error: update failed
    pulumi:pulumi:Stack postgres-alert-service.dsj-alerts.azure-dev **failed** 1 error
    cognite:database:azure:Postgres dsj-alerts-alert-service  
    cognite:database:Instance dsj-alerts-alert-service  

  azure-native:dbforpostgresql/v20221201:Server (dsj-alerts-alert-service):
    error: cannot create already existing subresource '/subscriptions/531564ca-ed4c-48b5-b4d0-6363b20c3aeb/resourceGroups/rg-postgresql-dsj-alerts-alert-service/providers/Microsoft.DBforPostgreSQL/flexibleServers/dsj-alerts-alert-service-azure-dev'

  pulumi:pulumi:Stack (postgres-alert-service.dsj-alerts.azure-dev):
    error: update failed

  - AdminPassword: [secret]
  - AdminUser    : "postgres"
  - Host         : "[snip]"
  - Port         : "5432"

    11 unchanged

Duration: 5s

stack: "alert-service.dsj-alerts.azure-dev"
We run our own k8s operator that runs pulumi, so that output might be a tiny bit nonstandard
Hmm, not sure on first glance. What does
pulumi refresh
@melodic-tomato-39005 Isn't it upgrading from Single Server to Flexible Server?
We’re already on flexible server
Nice, sorry for a wrong guess
@melodic-tomato-39005 our service only prints refresh logs on failure, so I don’t have any refresh output. I do have some failed refresh attempts from when we first tried v2
That failed with a ton of errors like so:
Copy code
azure-native:dbforpostgresql/v20210601:Configuration (idle_in_transaction_session_timeout):
    error: autorest/azure: Service returned an error. Status=400 Code="MissingApiVersionParameter" Message="The api-version query parameter (?api-version=) is required for all requests."
So you are refreshing successfully, you just don’t have the output?
Are you using component resources per chance? It sounds potentially similar to https://github.com/pulumi/pulumi-azure-native/issues/2505.
@melodic-tomato-39005 Yes, refresh seems successful. I think the issue you linked is relevant. We’re using a component resource to group some things
I see this comment, which could help: “Explicitly adding an alias to the
for the old name seems to allow Pulumi to keep the link, and avoids Pulumi wanting to delete stuff.”
Will resources be updated to the new API version in the stack file, or will we have to keep that alias around forever?
I’m not sure, sorry