pulumi-gcp: Error 412 while updating gcp.sql.DatabaseInstance
What 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).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 22 (7 by maintainers)
Commits related to this issue
- Patch Cloud SQL Database Instance to refresh settings.version Fixes #794. Cloud SQL Database Instance resources fail to update in Pulumi when the resource property `settings.settingsVersion` is modi... — committed to pulumi/pulumi-gcp by AaronFriel 10 months ago
- Patch Cloud SQL Database Instance to refresh settings.version Fixes #794, see also upstream issue: - https://github.com/hashicorp/terraform-provider-google/issues/15762 Cloud SQL Database Instance r... — committed to pulumi/pulumi-gcp by AaronFriel 10 months ago
- Patch Cloud SQL Database Instance to refresh settings.version Fixes #794, see also upstream issue: - https://github.com/hashicorp/terraform-provider-google/issues/15762 Cloud SQL Database Instance r... — committed to pulumi/pulumi-gcp by AaronFriel 10 months ago
- Patch Cloud SQL Database Instance to refresh settings.version (#1184) Fixes #794, see also upstream issue: - https://github.com/hashicorp/terraform-provider-google/issues/15762 Cloud SQL Database... — committed to pulumi/pulumi-gcp by AaronFriel 10 months ago
Running a
pulumi refresh
fixed this for usI am also experiencing this trying to add a database flag
@adriangb I’ve root caused the issue and we’re deciding how to proceed; whether to make the PR upstream or to apply a patch on our fork. I expect we should have an answer for you soon.
@same-id if this is the same issue, is it resolved by doing a
pulumi refresh
before running the update?Could you also tell us what the diff is on your resource or provide a minimal repro?