question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error 412 while updating gcp.sql.DatabaseInstance

See original GitHub issue

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).

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
saberisticcommented, Jun 28, 2022

I am also experiencing this trying to add a database flag

@@ -7,6 +7,10 @@ export const createInstance = (projectId: Output<string>, name: string, id: stri
         region: "us-west1",
         databaseVersion: "MYSQL_8_0",
         settings: {
+            databaseFlags: [{
+                name: "cloudsql_iam_authentication",
+                value: "on"
+            }],
             tier,
         },
         deletionProtection: true,
    error: 1 error occurred:
        * updating urn:pulumi:sandbox::baxus-devops::gcp:sql/databaseInstance:DatabaseInstance::services: 1 error occurred:
        * Error, failed to update instance settings for : googleapi: Error 412: Condition does not match., stale
0reactions
aetheryxcommented, Oct 5, 2022

Running a pulumi refresh fixed this for us

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found