-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: ignore disk_size when disk_autoresize is true #36
Conversation
Terraform Format and Style 🖌
|
@@ -69,7 +69,7 @@ resource "google_sql_database_instance" "instance" { | |||
disk_autoresize = var.settings_disk_autoresize | |||
disk_autoresize_limit = var.settings_disk_autoresize_limit | |||
disk_type = var.settings_disk_type | |||
disk_size = var.settings_disk_size | |||
disk_size = var.settings_disk_autoresize ? null : var.settings_disk_size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should be starting value of disk? You should have the default value of disk as 10GB and ignore the changes to the attribute disk_size in the life_cycle hooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we ignore the disk size @sunilhonest ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
life_cycle
already ignores updates to disk_size
. We don't need an initial value, it's optional and will default to the minimum size (10GB).
disk_size - (Optional) The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. The minimum value is 10GB.
If you think there's use-case where we need a manual initial size bigger than 10GB, we can only ignore it for read-replicas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to ignoresettings_disk_size
only for the read replica to allow a custom initial size for the master instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jai We have disk_autoresize
enabled and hence GCP increases the disk size. TF apply will try to reset it to value passed(ex: 10 GB in our case) and hence we should ignore it in the life_cycle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to update tests/check for this case?
Terraform Format and Style 🖌
|
The only test for this case is a scenario:
Quite complicated and not really worth it just for this case IMO. |
🎉 This PR is included in version 1.10.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Pull Request Submission Checklist
Please confirm that you have done the following before requesting reviews:
Description
settings_disk_size
whensettings_disk_autoresize
is set to true to avoid failing to create a read-replica after the master instance has been auto-scaled up.This change is