terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

Error: Provider produced inconsistent result after apply

Open Sreerag74031 opened this issue 9 months ago • 7 comments

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 a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version

1.8.0

Affected Resource(s)

google_bigquery_dataset_access

Terraform Configuration

resource "google_bigquery_dataset_access" "test_first_bq_dataset_security_editor_access" {
  project       = "test-project-bq-access"
  dataset_id    = "test_first_bq_dataset_security"
  role          = "roles/bigquery.dataEditor"
  group_by_email = "<AD_email>"
}

Debug Output

No response

Expected Behavior

Apply successful without errors

Actual Behavior

Apply errored with below message

Error: Provider produced inconsistent result after apply When applying changes to google_bigquery_dataset_access.test_first_bq_dataset_security_access, provider "provider["registry.terraform.io/hashicorp/google"]" produced an unexpected new value: Root object was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker

Steps to reproduce

  1. terraform apply

Important Factoids

No response

References

No response

Sreerag74031 avatar May 01 '24 15:05 Sreerag74031

Hi @Sreerag74031!

Didi you changed any specific argument like changing role = "roles/bigquery.dataEditor" for role = "OWNER" or are you changing the Google provider version, or the project?

Please be more specific on what you are changing to reproduce the issue

ggtisc avatar May 07 '24 22:05 ggtisc

Hi @ggtisc we were planning to use this resource google_bigquery_dataset_access but while testing we got below error from terraform apply. we tried this in Terraform Cloud

while checking gcp we see the configuration applied but the terraform apply failed so we are not able to use it.

Error: Provider produced inconsistent result after apply When applying changes to google_bigquery_dataset_access.test_first_bq_dataset_security_access, provider "provider["registry.terraform.io/hashicorp/google"]" produced an unexpected new value: Root object was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker

Sreerag74031 avatar May 20 '24 13:05 Sreerag74031

I'm trying to reproduce this issue, but after a terraform apply everything is good and without errors. What is the Google provider version that you are using?

According to the error message you got, this looks more like a bad configuration with the provider on your code

ggtisc avatar May 20 '24 17:05 ggtisc

I was using hashicorp/google version 5.0.0, we got the same error using latest version 5.30.0 we have other google resources in the same terraform configuration and those all got created without issues. Issue is only when we added the google_bigquery_dataset_access resource

Sreerag74031 avatar May 21 '24 02:05 Sreerag74031

Thank you!

I tried again to replicate this issue with your specifications, but again the result was successful without errors. So maybe you need to try to reproduce this with the minimum configuration in a separated environment as it is in this link.

Remember to be aware of the notes and warnings specified to achieve a good result

ggtisc avatar May 21 '24 18:05 ggtisc

Hello, I have the same error here, with different branches and repositories. This problem started to me on Jun 24th. We noticed that access is added on resource, but the apply code terraform fail.

terraform_error

julianafaria avatar Jun 28 '24 18:06 julianafaria

For my case, we identified the problem. The Google or Plugin Terraform is case sensitive. I saw the group that was added on resource by console, and put the same thing on terraform. If group is [email protected] we have to put the same name on code, with you put all in lowercase or change something that is uppercase to lowercase, it fail.

julianafaria avatar Jun 28 '24 19:06 julianafaria

Yes, as I commented on a previous response you need to check 1st for your project configuration and also is a good practice to make unit testing of the alone resource to see what is happening.

ggtisc avatar Jul 03 '24 18:07 ggtisc

Exactly as @julianafaria says, it seems to be case sensitive. This drives me nuts! If you are syncing groups from AD then this is very hard to manage, especially if they vary across environments...

It seems to me that this resource actually applies the change correctly but then crashes when reporting the result.

husseyd avatar Jul 31 '24 06:07 husseyd

Yes @husseyd you need to be aware of all these rules. You can learn more in the API and terraform registry

ggtisc avatar Jul 31 '24 16:07 ggtisc

Verified that when emails with mixed-case letters are sent in the API request, the API response will come back with the letters normalized to be all lower-case. In the UI, users are allowed to input mixed-case emails so the Terraform behavior should match to be consistent. Created https://github.com/GoogleCloudPlatform/magic-modules/pull/11477 to handle that. Waiting for approvals at the moment.

wj-chen avatar Aug 25 '24 23:08 wj-chen

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[bot] avatar Sep 27 '24 02:09 github-actions[bot]