hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.34k stars 1.74k forks source link

BQ Table time_partitioning.require_partition_filter - forces replacement #18982

Open kevinovendenwtc opened 3 months ago

kevinovendenwtc commented 3 months ago

Community Note

Terraform Version & Provider Version(s)

Terraform v1.9.3 on linux_amd64

Affected Resource(s)

Big Query Table (resource "google_bigquery_table").

Terraform Configuration

Debug Output

No response

Expected Behavior

The BQ Table should not be destroyed (drop/create).

Actual Behavior

BQ Table destroyed, built.

            ] # forces replacement
        )
      ~ self_link                = "https://bigquery.googleapis.com/bigquery/v2/projects/<project_id>/datasets/<table_id>/tables/<table_name>" -> (known after apply)
      ~ type                     = "TABLE" -> (known after apply)
        # (10 unchanged attributes hidden)

      ~ time_partitioning {
          ~ expiration_ms            = 0 -> (known after apply)
          - require_partition_filter = false -> null
            # (2 unchanged attributes hidden)
        }
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Steps to reproduce

  1. terraform apply

Important Factoids

I've tried tf destroy, tf apply. Re-creating from scratch. The BQ Table is reporting destroy in each plan / apply.

Attempted terraform init -upgrade --> v5.39.0/1, same behaviour.

2024-08-05T13:04:15.529Z [WARN]  Provider "registry.terraform.io/hashicorp/google" produced an invalid plan for module.tables["<table_name>"].google_bigquery_table.table, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .max_staleness: planned value cty.StringVal("") for a non-computed attribute
      - .require_partition_filter: planned value cty.False for a non-computed attribute
      - .friendly_name: planned value cty.StringVal("") for a non-computed attribute

References

No response

kevinovendenwtc commented 3 months ago

google provider update --> v5.40.0. Added BQ Table.deletion_protection: TRUE

Above resolved the issue.

TAG Policy and BQ Table deletion_protection interaction a potential for review.

ggtisc commented 3 months ago

Hi @kevinovendenwtc!

I tried to replicate this issue but the result was successful without errors and it was an update-in-place instead of a replacement destroying the existing resource.

On the other hand I think that it's not possible to update it since this is a deprecated argument and it is about to be removed for many reasons.

By removing the require_partition_filter argument, you've effectively replicated the previous behavior. BigQuery will now enforce the use of partition filters for queries on your time-partitioned table.

No further configuration changes are needed.