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

Google BigQuery table are being force replaced , even when there is no change in the schema structures. #9472

Closed
Sophyiya opened this issue Jun 30, 2021 · 9 comments · Fixed by GoogleCloudPlatform/magic-modules#4943, #9499 or hashicorp/terraform-provider-google-beta#3405
Assignees
Labels

Comments

@Sophyiya
Copy link

Noticed similar kind of issues about force replacement were already discussed at #8710 and #8803, also fix was released.But when we were trying to provision the bigquery table resource with google provider V3.74.0, during the consecutive Terraform apply,the tables are being force replaced(detroyed and recreated)even though there is no change in the schema structure

Interestingly, when we tried Terraform apply using one of the older google provider V3.55.0 and could see there was no force replacements.

Is this the expected behavior? And how to avoid the force replacements for bigquery tables in V3.74.0?

@venkykuberan
Copy link
Contributor

@Sophyiya Can you please attach the plan output to get an idea about what's causing the resource to be recreated ?

@Sophyiya
Copy link
Author

Sophyiya commented Jul 1, 2021

terraform_plan_forces_replacement.txt

@venkykuberan I have uploaded the terraform plan which forces the replacement of tables. The plan shows that the Objects have changed outside of Terraform, but that is not the case.

@venkykuberan
Copy link
Contributor

It looks like case-sensitive diff causing the resource to be recreated. I will change this issue as bug and we will work on the fix.

@Sophyiya
Copy link
Author

Sophyiya commented Jul 1, 2021

@venkykuberan Thanks for the update. So the reason for force replacement is "type" and "mode" for the columns were case sensitive. Did I get the root cause correctly?

@melinath
Copy link
Collaborator

melinath commented Jul 1, 2021

@Sophyiya yes, that's what is causing the recreation.

@melinath
Copy link
Collaborator

melinath commented Jul 1, 2021

I don't know if they're case sensitive for BigQuery table schemas; from the terraform side, we have considered those fields to be case-sensitive, which is what triggered recreation.

@Sophyiya
Copy link
Author

Sophyiya commented Jul 1, 2021

@melinath Thanks for confirming.

@melinath
Copy link
Collaborator

melinath commented Jul 1, 2021

Verified I can reproduce this locally. BigQuery table accepts lowercase mode & type and then uppercases them in the returned value, causing a permadiff.

melinath added a commit to melinath/magic-modules that referenced this issue Jul 1, 2021
BigQuery table schema normalizes the mode and type to uppercase, which causes a permadiff for the end user if they set it in lowercase.

Also removed tests for setting type to nil, because a field type being nil is invalid.

Resolved hashicorp/terraform-provider-google#9472
melinath added a commit to GoogleCloudPlatform/magic-modules that referenced this issue Jul 2, 2021
* Ignored case changes in bigquery table schema mode/type

BigQuery table schema normalizes the mode and type to uppercase, which causes a permadiff for the end user if they set it in lowercase.

Also removed tests for setting type to nil, because a field type being nil is invalid.

Resolved hashicorp/terraform-provider-google#9472

* Handle invalid input from users without a panic
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Jul 2, 2021
* Ignored case changes in bigquery table schema mode/type

BigQuery table schema normalizes the mode and type to uppercase, which causes a permadiff for the end user if they set it in lowercase.

Also removed tests for setting type to nil, because a field type being nil is invalid.

Resolved hashicorp#9472

* Handle invalid input from users without a panic

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to modular-magician/terraform-provider-google-beta that referenced this issue Jul 2, 2021
* Ignored case changes in bigquery table schema mode/type

BigQuery table schema normalizes the mode and type to uppercase, which causes a permadiff for the end user if they set it in lowercase.

Also removed tests for setting type to nil, because a field type being nil is invalid.

Resolved hashicorp/terraform-provider-google#9472

* Handle invalid input from users without a panic

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit that referenced this issue Jul 2, 2021
* Ignored case changes in bigquery table schema mode/type

BigQuery table schema normalizes the mode and type to uppercase, which causes a permadiff for the end user if they set it in lowercase.

Also removed tests for setting type to nil, because a field type being nil is invalid.

Resolved #9472

* Handle invalid input from users without a panic

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to hashicorp/terraform-provider-google-beta that referenced this issue Jul 2, 2021
* Ignored case changes in bigquery table schema mode/type

BigQuery table schema normalizes the mode and type to uppercase, which causes a permadiff for the end user if they set it in lowercase.

Also removed tests for setting type to nil, because a field type being nil is invalid.

Resolved hashicorp/terraform-provider-google#9472

* Handle invalid input from users without a panic

Signed-off-by: Modular Magician <[email protected]>
@github-actions
Copy link

github-actions bot commented Aug 2, 2021

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 Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.