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

Error: Provider produced inconsistent final plan - "registry.terraform.io/hashicorp/google" produced an invalid new value for .terraform_labels: new element "date_modified" has appeared. #16217

Comments

@danishkamili
Copy link

danishkamili commented Oct 11, 2023

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.

Issue:

Terraform fails to apply the plan, due to invalid new value for .terraform_labels: new element "date_modified" has appeared. While updating the resource GCP project.

Terraform Version

Terraform v1.0.10

Affected Resource(s)

  • google_project

Terraform Configuration Files

# Copy-paste your Terraform configurations here.
its from public Google LZ repo and this is the url to bootstrap files
https://github.com/GoogleCloudPlatform/pbmm-on-gcp-onboarding/tree/main/environments/bootstrap

It fails at bootstrapping folder, only need to update the .tfvars and follow the instructions to bootstrap.sh (which needs billing ID, organization ID and folder ID where you want to create the boostrap project, first plan and apply is good, however, the subsequent apply fails - due to inconsistency.

Debug Output

https://gist.github.com/danishkamili/3378fc6e5001da2a3c1653208295d585

Panic Output

Error: Provider produced inconsistent final plan

│ When expanding the plan for module.landing_zone_bootstrap.module.project.google_project.project to include new values learned so far during apply, provider
│ "registry.terraform.io/hashicorp/google" produced an invalid new value for .terraform_labels: new element "date_modified" has appeared.

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


│ Error: Provider produced inconsistent final plan

│ When expanding the plan for module.landing_zone_bootstrap.module.project.google_project.project to include new values learned so far during apply, provider
│ "registry.terraform.io/hashicorp/google" produced an invalid new value for .effective_labels: new element "date_modified" has appeared.

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

Expected Behavior

Apply should be successful without adding additional labels

Actual Behavior

Terraform apply failed while trying to add a new label : date modified to the resource

Steps to Reproduce

  1. terraform apply

References

#12043
#10131

b/304967677

@fmichaelobrien
Copy link

We will need to look at upgrading from 1.0 to 1.5.7 or the new 1.6.0 https://releases.hashicorp.com/terraform/1.6.0/ as a first step in the https://github.com/GoogleCloudPlatform/pbmm-on-gcp-onboarding codebase

@danishkamili
Copy link
Author

Setting a provider as per below suppressed the error, as its a change done at version >=5.0.0,
https://www.hashicorp.com/blog/terraform-google-provider-adds-updates-to-default-labels

Effective labels: A new output-only attribute added to all resources, where the value contains a combination of all labels set on the resource in the Terraform configuration and any other labels present on the resource in Google Cloud that aren’t managed via Terraform.

required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.50, < 5.0.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 3.50, < 5.0.0"
}
}

@davidedironza
Copy link

Is there a timeline when this will be fixed?
We have a lot of projects to apply and we always get these errors "... .terraform_labels: new element ..."

@zli82016
Copy link
Collaborator

zli82016 commented Mar 7, 2024

Found a similar issue
hashicorp/terraform-provider-aws#19583

Can you try Re-apply the terraform to see if the second terraform apply works, @davidedironza ?

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