terraform-provider-google: Setting redis maintenance_policy causes creation of unexpected config block of maintenance_schedule
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.
- If an issue is assigned to the
modular-magicianuser, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot, a community member has claimed the issue already.
Terraform Version
Terraform v0.13.7
Affected Resource(s)
resource āgoogle_redis_instanceā
Terraform Configuration Files
resource "google_redis_instance" "cache_instance" {
name = "cache-instance"
tier = "STANDARD_HA"
memory_size_gb = 2
location_id = local.gcp_zones[0]
alternative_location_id = local.gcp_zones[1]
authorized_network = local.network
connect_mode = "PRIVATE_SERVICE_ACCESS"
labels = local.labels
maintenance_policy {
weekly_maintenance_window {
day = "SUNDAY"
start_time {
hours = 9
}
}
}
}
Debug Output
https://gist.github.com/yonicurv/1a9006c0ec9bee33f4ce13c01f19835d
Expected Behavior
Do not try to remove scheduled maintenance.
Actual Behavior
Tries to remove and fails with : Error 400: Invalid option āmaintenance_scheduleā: āmaintenance_scheduleā cannot be updated on existing instances.
Steps to Reproduce
terraform apply- Let GCP to schedule next maintenance.
terraform apply
Workaround
Add the following block to ignore any changes related to maintenance_schedule, and preserve the configuration of maintenance_policy for future schedules.
lifecycle {
ignore_changes = [
maintenance_schedule,
]
}
References
https://github.com/hashicorp/terraform-provider-google/pull/10978 https://github.com/hashicorp/terraform-provider-google/issues/9622
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 43
- Comments: 16
Commits related to this issue
- fix: 400 error when updating existing redis instances We ran into the same issue documented in https://github.com/hashicorp/terraform-provider-google/issues/11871 This PR adds a workaround to the iss... — committed to mozilla/terraform-modules by bqbn a year ago
- fix: 400 error when updating existing redis instances (#119) We ran into the same issue documented in https://github.com/hashicorp/terraform-provider-google/issues/11871 This PR adds a workaround to... — committed to mozilla/terraform-modules by bqbn a year ago
Lifecycle worked for me, as a temporary solution.
lifecycle {
ignore_changes = [ maintenance_schedule, ] }
Is there any solution to this other than ignoring the changes?