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.33k stars 1.73k forks source link

Permanent diff for google_bigquery_dataset friendly_name #13951

Closed pingyeh closed 1 year ago

pingyeh commented 1 year ago

Community Note

Terraform Version

$ terraform --version
Terraform v1.3.9
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v4.56.0

Your version of Terraform is out of date! The latest version
is 1.4.0. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

Terraform Configuration Files

resource "google_bigquery_dataset" "aquarium" {                                     
  project       = local.project_id
  dataset_id    = "aquarium"
  description   = "Tables for internal Aquarium work"
  location      = "US"
}                                                                                   

Debug Output

https://gist.github.com/pingyeh/d61c215819646527a241eaf1153f74e1

Panic Output

Expected Behavior

The BigQuery dataset has a non-empty friendly_name. It should be set to null as indicated by terraform apply.

Actual Behavior

Terraform tries to remove the friendly_name attribute:

  # google_bigquery_dataset.aquarium will be updated in-place
  ~ resource "google_bigquery_dataset" "aquarium" {
      - friendly_name                   = "Aquarium work" -> null
        id                              = "projects/{project_id_redacted}/datasets/aquarium"
        # (12 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

The friendly_name has not changed after terraform apply. Reapplying again produces the same diff over and over.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

edwardmedia commented 1 year ago

@pingyeh I am not able to repro this issue in both conditions (with and without friendly_name in the config). No permadiff is found. Reviewed the log you provided, I do see friendly_name in the api response. I don't see the request call in your log that created the dataset. Wonder if you created the dataset with the friendly_name and updated the config afterward?

Please detail the repro steps if that is not the case

pingyeh commented 1 year ago

The dataset was created before I started using terraform, so the config was imported.

I added a friendly_name among other attributes to the config after the import, ran terraform apply successfully, then I wanted to remove the friendly_name because I realized that it is not visible on the Google Cloud Console in the new UI now. Terraform apply shows the diff correctly:

      - friendly_name                   = "Aquarium work" -> null

But terraform apply was a NOP. The diff is still there.

edwardmedia commented 1 year ago

@pingyeh I understand now what the problem is. Basically you are not able to remove it. Yes, this is a bug in the provider.

pingyeh commented 1 year ago

@edwardmedia Thanks for recognizing the bug!

What's the plan?

pingyeh commented 1 year ago

@edwardmedia I just set my google provider to version = ">= 4.57.0" released today, but the permadiff still exists. Will the fix be available in the next release?

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.