Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BQ Dataset location is Case Sensitive in Terraform #9801

Closed
Assignees
Labels

Comments

@ruchirjain86
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

$ terraform --version
Terraform v1.0.3

Affected Resource(s)

google_bigquery_dataset

Terraform Configuration Files

resource "google_bigquery_dataset" "operation_logging_dataset" {
  dataset_id                  = "test_datatset"
  friendly_name               = "test_datatset"
  description                 = "Dataset to host logs"
  location                    = "us"
  project                     = "test-project-1"
  labels                      = {}
}

Expected Behavior

If location is specified in lowercase like "us", the first time you apply terraform apply everything works fine but then next time if terraform apply is done, the dataset should not destroyed and recreated (if not changes are done to terraform code)

Actual Behavior

If location is specified in lowercase like "us", the first time you apply terraform apply everything works fine but then next time if terraform plan or apply is done, terraform suggests that it needs to destroy the dataset and create it again and the reason given is the location change from uppercase "US" to lowercase "us".

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # google_bigquery_dataset.operation_logging_dataset must be replaced
-/+ resource "google_bigquery_dataset" "operation_logging_dataset" {
      ~ creation_time                   = 1628839961940 -> (known after apply)
      - default_partition_expiration_ms = 0 -> null
      - default_table_expiration_ms     = 0 -> null
      ~ etag                            = "AjoBjlvOgC2ZzMEozc4r9Q==" -> (known after apply)
      ~ id                              = "projects/toc-ncc-spoke-1/datasets/test_datatset" -> (known after apply)
      - labels                          = {} -> null
      ~ last_modified_time              = 1628839961940 -> (known after apply)
      ~ location                        = "US" -> "us" # forces replacement
      ~ self_link                       = "https://bigquery.googleapis.com/bigquery/v2/projects/toc-ncc-spoke-1/datasets/test_datatset" -> (known after apply)

Since location is actually not changing and BiqQuery saves the location as uppercase even if in terraform it is specified as lower case. The TF code should not consider a location change for a dataset if the change is just in the case of the loaction.

Steps to Reproduce

  1. Create a BQ dataset resource and specify the location as lowercase "us".
  2. Do a 'terraform apply'
  3. Do a 'terraform apply' again. (Note: do not change anything in TF code)
  4. TF will complain that it needs to recreate the dataset because of location change from "US" to "us"
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.