Open penenkel opened 1 month ago
This looks specific to Azure Native so I'll transfer this over to that repo and someone will take a look soon.
Hi @penenkel thanks for writing this up.
The Native provider should generally have the same behaviour as using an ARM or Bicep template as we're a fairly direct mapping to Azure's APIs. I agree it sounds like this would be a nice usability enhancement here too.
It looks like the design used in the classic provider is not to do this via a resource property, but rather as a global provider configuration. This does not sound like an ideal design to copy. Instead, perhaps we could model this by adding a property to the Configuration resource to auto-restart on update. Alternatively, it might be possible to model this as a second resource which depends on the configuration, and triggers a restart if any change is make. This likely needs a little more design before moving ahead with an implementation.
For the time being, I think this could be worked around using either a dynamic provider, or the command provider to trigger the restart.
For example (not tested):
resources:
configuration:
type: azure-native:dbforpostgresql:Configuration
properties:
configurationName: event_scheduler
resourceGroupName: testrg
serverName: testserver
source: user-override
value: on
serverRestart:
type: command:local:Command
properties:
update: az postgres flexible-server restart --name testserver
triggers:
- ${configuration}
Hello!
Issue details
I recently ran into an issue where, after creating a Configuration, a restart of the server was necessary before a subsequent provisioning step could complete. Is it by design that such a restart is not automatically performed by Pulumi for the Azure Native provider?
The docs for the Postgres Flexible Server Configuration resource in the classic Azure provider contain a note that the server is automatically restarted by default whenever a Configuration resource is created.
No such note exists for the corresponding Configuration resource in the Azure Native provider. And my experience seems to indicate that in fact no restart is automatically performed.
To me it seems like this would be a useful feature. Or perhaps some kind of resource/API to initiate a controlled restart from within Pulumi? There seems to exist an output on the Configuration called
IsConfigPendingRestart
so presumably one could react to that and initiate a restart explicitly in the Pulumi program. But there does not seem to exist any Pulumi API for executing a server restart. The only thing I can think of atm is using aAzurePowerShellScript
resource to trigger the restart via the Azure API or CLI, but that is a lot of effort for something that is needed by almost everyone that uses a Postgres Configuration resource.Affected area/feature
azure-native.dbforpostgresql.Configuration