Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure-native.dbforpostgresql.Configuration should restart the server automatically #3618

Open
penenkel opened this issue Oct 2, 2024 · 2 comments
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/enhancement Improvements or new features

Comments

@penenkel
Copy link

penenkel commented Oct 2, 2024

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

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 a AzurePowerShellScript 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

@penenkel penenkel added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Oct 2, 2024
@justinvp
Copy link
Member

justinvp commented Oct 2, 2024

This looks specific to Azure Native so I'll transfer this over to that repo and someone will take a look soon.

@justinvp justinvp transferred this issue from pulumi/pulumi Oct 2, 2024
@danielrbradley
Copy link
Member

danielrbradley commented Oct 4, 2024

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.

Workaround

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}

@danielrbradley danielrbradley added impact/usability Something that impacts users' ability to use the product easily and intuitively kind/enhancement Improvements or new features and removed kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants