Error 412 while updating gcp.sql.DatabaseInstance
See original GitHub issueWhat happened?
I’m attempting to enable the High Availability setting for an existing GCP Postgres SQL instance. Adding the availability type parameter returns the following error
pulumi:pulumi:Stack (app):
error: update failed
gcp:sql:DatabaseInstance (db-server):
error: 1 error occurred:
* updating urn:pulumi:test::app::gcp:sql/databaseInstance:DatabaseInstance::db-server: 1 error occurred:
* Error, failed to update instance settings for : googleapi: Error 412: Condition does not match., staleData
Steps to reproduce
Create a DB instance
export const dbInstance = new gcp.sql.DatabaseInstance("db-server", {
databaseVersion: "POSTGRES_11",
region: "us-central1",
settings: {
tier: "db-g1-small",
diskAutoresize: false,
backupConfiguration: {
enabled: false,
location: "us-central1",
pointInTimeRecoveryEnabled: false,
startTime: "01:00",
transactionLogRetentionDays: 7,
backupRetentionSettings: {
retainedBackups: 14,
},
},
userLabels: {
"env": "test",
}
},
deletionProtection: false,
});
Add availabilityType to the instance settings
export const dbInstance = new gcp.sql.DatabaseInstance("db-server", {
databaseVersion: "POSTGRES_11",
region: "us-central1",
settings: {
tier: "db-g1-small",
diskAutoresize: isProduction,
availabilityType: "REGIONAL",
backupConfiguration: {
enabled: false,
location: "us-central1",
pointInTimeRecoveryEnabled: false,
startTime: "01:00",
transactionLogRetentionDays: 7,
backupRetentionSettings: {
retainedBackups: 14,
},
},
userLabels: {
"env": "test",
}
},
deletionProtection: false,
Run pulumi up
Expected Behavior
The existing GCP SQL database instance availability is changed from ZONAL to REGIONAL.
Actual Behavior
The update fails and returns the error above. The following data was also in the logs:
I0416 18:13:19.856905 770 eventsink.go:59] {
I0416 18:13:19.857036 770 eventsink.go:59] "error": {
I0416 18:13:19.857204 770 eventsink.go:59] "code": 412,
I0416 18:13:19.857382 770 eventsink.go:59] "message": "Condition does not match.",
I0416 18:13:19.857524 770 eventsink.go:59] "errors": [
I0416 18:13:19.857688 770 eventsink.go:59] {
I0416 18:13:19.857862 770 eventsink.go:59] "message": "Condition does not match.",
I0416 18:13:19.858078 770 eventsink.go:59] "domain": "global",
I0416 18:13:19.858259 770 eventsink.go:59] "reason": "staleData",
I0416 18:13:19.858431 770 eventsink.go:59] "location": "If-Match",
I0416 18:13:19.858601 770 eventsink.go:59] "locationType": "header"
I0416 18:13:19.858765 770 eventsink.go:59] }
I0416 18:13:19.858935 770 eventsink.go:59] ]
I0416 18:13:19.859112 770 eventsink.go:59] }
I0416 18:13:19.859292 770 eventsink.go:59] }
Versions used
Pulumi version: 3.29.1
Additional context
Adding anything appears to trigger the error, including explicitly entering the default value availabilityType: "ZONAL"
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you’ve opened one already).
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Cloud SQL Admin API error messages
This page lists Cloud SQL Admin API error codes. ... request contains invalid primary or secondary application IDs when creating or updating an...
Read more >Getting Error 412 Precondition Failed errors from Google ...
Hi, I am in the process of writing a recipe which updates my Google Contacts. When attempting the execute the `Update Contact in...
Read more >GCP cloud storage bucket with uniform bucket-level access ...
Error: GCP cloud storage bucket with uniform bucket-level access are disabled Bridgecrew Policy ID: BC_GCP_GCS_2Checkov Check ID: CKV_GCP_29Severity: ...
Read more >Help - vRealize Operations 8.6 - VMware Docs
What happens when network latency between fault domains exceeds 20 ms? ... Assess the vRealize Operations installation, patching, and upgrade history and.
Read more >Citrix Provisioning 2203
Enable secure connection by limiting SQL server to TLS 1.2 ... When upgrading Citrix Provisioning to the newest version, the latest License ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I am also experiencing this trying to add a database flag
Running a
pulumi refreshfixed this for us