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

azurerm_postgresql_flexible_server_configuration restarts the underlying server on each value change #22257

Closed
1 task done
igorkliushnikov opened this issue Jun 23, 2023 · 5 comments · Fixed by #23811
Closed
1 task done

Comments

@igorkliushnikov
Copy link
Contributor

igorkliushnikov commented Jun 23, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.3.2

AzureRM Provider Version

3.40+

Affected Resource(s)/Data Source(s)

azurerm_postgresql_flexible_server_configuration

Terraform Configuration Files

# any server_configuration, for example, the one from docs:
resource "azurerm_postgresql_flexible_server" "example" {
  name                   = "example-psqlflexibleserver"
  resource_group_name    = azurerm_resource_group.example.name
  location               = azurerm_resource_group.example.location
  version                = "12"
  administrator_login    = "psqladmin"
  administrator_password = "H@Sh1CoR3!"

  storage_mb = 32768

  sku_name = "GP_Standard_D4s_v3"
}

resource "azurerm_postgresql_flexible_server_configuration" "example" {
  name      = "backslash_quote"
  server_id = azurerm_postgresql_flexible_server.example.id
  value     = "on"
}

Debug Output/Panic Output

There is no errors, but Azure Flex Server is restarted

Expected Behaviour

Changing flex-server configuration should work the same as in az-cli or azure-portal: updating single parameter should not trigger immediate server restart.

We have a scenario, when the fleet of flex servers is managed by an extended team, that could change several config settings. This scenario works fine when team contributes to the terraform over extended period of time, and then we apply changes during the maintenance window. We want to control when to restart the service, as it could cause disruptions to the clients. For example, recently we introduced around 10 config values change at once, which caused unexpected restart storm.

Actual Behaviour

Each parameter change triggers undocumented server restarts, which is disruptive operation. This behaviour differs from other native tools or from Azure Single Server configuration.

This change was introduced in #20044

Steps to Reproduce

No response

Important Factoids

No response

References

@neil-yechenwei
Copy link
Contributor

Thanks for raising this issue. I assume it's by TF design since the request of restarting server for static parameters is from service team and they confirmed that the server needs to be restarted to reflect the change on static parameters. Currently, TF only restarts the server against static parameters. It wouldn't restart server against dynamic parameters. For your situation, suggest to put the list of static parameters in front of the list of dynamic parameters in tf config.

@igorkliushnikov
Copy link
Contributor Author

This behavior is confusing: TF adds some special and not documented action on top of parameter update. The server restart is a kind of tricky side effect which you do not expect. Why then azure-cli or azure portal does not do the same?

I wish Infrastructure-related software to be boringly predictable :)

@igorkliushnikov
Copy link
Contributor Author

@neil-yechenwei, is it possible to make the restarts optional? Maybe, postgresql_flexible_server_configuration could have a toggle like apply_immediately or something similar?

On the spot I cannot come up with any other SaaS solution which enforces mandatory restart on each server parameter change (even in Azure stack). I think, regular customer wouldn't expect such events from the box. Server restart is disruptive operation in general, so there should be a possibility to control when and how customer can perform it.

I assume there might be use-cases when immediate restart is the desired outcome, but I believe it should be a conscious choice of the infrastructure operator.

What do you think?

@igorkliushnikov
Copy link
Contributor Author

@neil-yechenwei , @rcskosir, I implemented a provider feature that allows to disable postgres server restarts: #23811. The implementation is 100% backward compatible so it should not change behaviour of any existing code. Could you check it out?
This design was proposed by Tom in slack/contributors a few months ago, and I liked the idea.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants