pulumi / pulumi-gcp

A Google Cloud Platform (GCP) Pulumi resource package, providing multi-language access to GCP
Apache License 2.0
182 stars 52 forks source link

Re-creating materialized view fails (gcp.bigquery.Table) #2491

Open brent-statsig opened 5 hours ago

brent-statsig commented 5 hours ago

Describe what happened

package.json

"dependencies": {
    "@pulumi/gcp": "^8.3.1",
    "@pulumi/pulumi": "^3.112.0",
  }

Updating a materialize view in bigquery triggers a replacement, that fails, because the table already exists in bigquery.

Sample program

Log output

error: 1 error occurred:
        * googleapi: Error 409: Already Exists: Table my-project:my-source.my-materialized-table, duplicate
        *

Affected Resource(s)

No response

Output of pulumi about

pulumi about
Enter your passphrase to unlock config/secrets
    (set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your passphrase to unlock config/secrets
CLI
Version      3.119.0
Go Version   go1.22.4
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  gcp     8.3.1
resource  gcp     8.2.0
resource  gcp     7.18.0
language  nodejs  unknown

Host
OS       darwin
Version  13.0
Arch     arm64

This project is written in nodejs: executable='/Users/brentechols/.nvm/versions/node/v20.11.1/bin/node' version='v20.11.1'

Additional context

No response

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

brent-statsig commented 3 hours ago

Oh - I figured out the issue, deleteBeforeReplace needs to be enabled. This feels very unintuitive though, especially since so many GCP resources are globally unique by resource id, and will run into this problem. Especially with things like tables/datasets/etc, which will be referenced by their name external to pulumi, there is no "uptime" friendly way to do a replace.

Can these resources be changed to have deleteBeforeReplace be defaulted to true?