-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
bugforward/reviewIn review; remove label to forwardIn review; remove label to forwardservice/sqladmin-cp
Description
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 a user, that user is claiming responsibility for the issue.
- Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.
Terraform Version & Provider Version(s)
Tofu v1.10.6
- provider registry.terraform.io/hashicorp/google v7.12.0
Affected Resource(s)
google_sql_database_instance MySQL & PostgreSQL
Terraform Configuration
resource "google_sql_database_instance" "mysql" {
name = var.instance_name
database_version = var.database_version
region = var.region
deletion_protection = var.deletion_protection
# Replica configuration
dynamic "replica_configuration" {
for_each = var.replica ? [1] : []
content {
failover_target = var.failover_target
}
}
# Null if replica is not set
master_instance_name = var.replica ? var.master_instance_name : null
settings {
# This setting will enable Deletion Prevention in GCP
deletion_protection_enabled = var.deletion_protection_enabled
tier = var.tier
edition = var.edition
# Availability configuration
availability_type = var.availability_type
# Disk settings for high performance
disk_type = "PD_SSD"
disk_size = var.disk_size
disk_autoresize = true
disk_autoresize_limit = 0
...
}module "{{ instance_name | replace("-", "_") }}" {
source = "{{ module_path }}"
project_id = "{{ gcp_project }}"
instance_name = "{{ instance_name }}"
region = lookup(local.input, "region", "us-central1")
database_version = lookup(local.input, "database_version", "MYSQL_8_0")
tier = local.tier
disk_size = lookup(lookup(local.input, "storage", {}), "disk_size_gb", 15)
...
}
module "{{ replica_instance_name | replace("-", "_") }}" {
source = "{{ module_path }}"
project_id = "{{ gcp_project }}"
instance_name = "{{ replica_instance_name }}"
region = "{{ replica_region }}"
master_instance_name = "{{ instance_name }}"
replica = true
failover_target = false
database_version = lookup(local.input, "database_version", "MYSQL_8_0")
tier = local.tier
disk_size = lookup(lookup(local.input, "storage", {}), "disk_size_gb", 15)
...
}Debug Output
No response
Expected Behavior
I would expect the primary instance tier and disk size to be updated and then the replica gets updated after running tofu apply without resulting in an error.
Actual Behavior
The primary instance is updated but receiving Error 412: Condition does not match., staleData when the replica tries to update. See logs:
$ tofu apply -auto-approve tfplan.binary
module.test_db.google_sql_database_instance.mysql: Modifying...
module.test_db.google_sql_database_instance.mysql: Still modifying...
module.test_db.google_sql_database_instance.mysql: Still modifying...
module.test_db.google_sql_database_instance.mysql: Still modifying...
module.test_db.google_sql_database_instance.mysql: Still modifying...
module.test_db.google_sql_database_instance.mysql: Still modifying...
module.test_db.google_sql_database_instance.mysql: Still modifying...
module.test_dbgoogle_sql_database_instance.mysql: Modifications complete after 1m1s
module.test_db.google_sql_database_instance.mysql: Modifying...
module.test_db.google_sql_database_instance.mysql: Still modifying...
module.test_db_e.google_sql_database_instance.mysql: Still modifying...
module.test_db_e.google_sql_database_instance.mysql: Still modifying...
module.test_db_e.google_sql_database_instance.mysql: Still modifying...
module.test_db_e.google_sql_database_instance.mysql: Still modifying...
module.test_db_e.google_sql_database_instance.mysql: Still modifying...
module.test_db_e.google_sql_database_instance.mysql: Still modifying...
╷
│ Error: Error, failed to update instance settings for : googleapi: Error 412: Condition does not match., staleData
Steps to reproduce
- Update tier and/or disk size for primary and replica modules
tofu apply
Important Factoids
No response
References
No response
Metadata
Metadata
Assignees
Labels
bugforward/reviewIn review; remove label to forwardIn review; remove label to forwardservice/sqladmin-cp