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

Allow optional storage size with auto_grow enabled #5121

Closed
croissong opened this issue Dec 10, 2019 · 4 comments · Fixed by #6459
Closed

Allow optional storage size with auto_grow enabled #5121

croissong opened this issue Dec 10, 2019 · 4 comments · Fixed by #6459

Comments

@croissong
Copy link

croissong commented Dec 10, 2019

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

Description

We're experiencing an undesired behavior when enabling auto_grow for a postgresql server.
As the storage_mb setting is required, each time the storage size is automatically increased via autogrow, terraform detects a change and storage_mb needs to be manually increased as well.
Ideally, storage_mb would be optionally if auto_grow is enabled.

New or Affected Resource(s)

  • azurerm_postgresql_server

Potential Terraform Configuration

resource "azurerm_postgresql_server" "db" {
...
  storage_profile {
    storage_mb            = var.storage_mb
    auto_grow             = "Enabled"
  }
@r0bnet
Copy link
Contributor

r0bnet commented Dec 16, 2019

Hey @croissong,

as a workaround i'd propose the following:

resource "azurerm_postgresql_server" "db" {
...
  storage_profile {
    storage_mb            = var.storage_mb
    auto_grow             = "Enabled"
  }

  lifecycle {
    ignore_changes = [storage_profile.storage_mb]
  }

Is that a viable option for you? Tbf I didn't test that but it might work.

@jemrobinson
Copy link

For anyone else facing this issue, I found that the following minor tweak to @r0bnet 's solution worked in Terraform v0.12.20.

  lifecycle {
    ignore_changes = [storage_profile[0].storage_mb]
  }

katbyte added a commit that referenced this issue Apr 21, 2020
refactor code and tests to

support for create_mode, creation_source_server_id, infrastructure_encryption_enabled,public_network_access_enabled, ssl_minimal_tls_version_enforced properties
support replicas
computed storage_mb when auto_grow_enabled is true
use booleans for toggle properties by renaming:
-- ssl_enforcement -> ssl_enforcement_enabled
-- geo_redundant_backup -> backup_geo_redundant_enabled
-- auto_grow -> auto_grow_enabled
move all properties within the storage_profile block to the top level
superseeds #6241
fixes #6216
fixes #6180
fixes #5865
fixes #5121
fixed #2819
@katbyte katbyte added this to the v2.7.0 milestone Apr 21, 2020
@ghost
Copy link

ghost commented Apr 23, 2020

This has been released in version 2.7.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.7.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 22, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants