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 result after apply #6486

Closed
Pritilender opened this issue May 29, 2020 · 8 comments
Closed

Error: Provider produced inconsistent result after apply #6486

Pritilender opened this issue May 29, 2020 · 8 comments
Assignees
Labels
forward/review In review; remove label to forward question service/serviceusage

Comments

@Pritilender
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 v0.12.26
+ provider.google v3.23.0

Affected Resource(s)

  • google_project_service

Terraform Configuration Files

provider "google" {
  version = "~> 3.0"
  project = "m-tools-terraform-admin"
}

resource "google_project" "foo" {
  name = "foo-bar-baz"
  project_id = "foo-bar-baz-test"
  org_id = var.organization_id
  billing_account = var.billing_account_id
}

resource "google_project_service" "foo" {
  project = google_project.foo.id
  service = "firebase.googleapis.com"

  disable_dependent_services = true
}

Debug Output

Gist to the debug output

Panic Output

Expected Behavior

The API service should been enabled for the project.

Actual Behavior

I get following error from TF: "Error: Provider produced inconsistent result after apply"
And the API service is not enabled, even after multiple apply runs.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

I saw a few of issues with similar name, but from my investigation, there is no issue regarding google_project_service resource.

@ghost ghost added bug labels May 29, 2020
@edwardmedia edwardmedia self-assigned this May 29, 2020
@edwardmedia
Copy link
Contributor

@Pritilender can you take a look below solution and see if that helps address your issue?

#6377

@Pritilender
Copy link
Author

Pritilender commented May 29, 2020

@edwardmedia I've tried the approach with null_resource (mentioned here) and the other approach with depending on the project (mentioned here), but with no success. The issue persists.

@ghost ghost removed the waiting-response label May 29, 2020
@edwardmedia
Copy link
Contributor

@Pritilender can you post the new code with null_resource added?

@Pritilender
Copy link
Author

Pritilender commented May 29, 2020

Yes, here's the code:

provider "google" {
  version = "~> 3.0"
  project = "m-tools-terraform-admin"
}

resource "google_project" "foo" {
  name = "foo-bar-baz"
  project_id = "foo-bar-baz-test"
  org_id = var.organization_id
  billing_account = var.billing_account_id
}

resource "null_resource" "delay" {
  provisioner "local-exec" {
    command = "sleep 60"
  }
  triggers = {
    "project" = "${google_project.foo.id}"
  }
}

resource "google_project_service" "foo" {
  project = google_project.foo.id
  service = "firebase.googleapis.com"

  disable_dependent_services = true
  depends_on = [null_resource.delay]
}

@ghost ghost removed the waiting-response label May 29, 2020
@edwardmedia
Copy link
Contributor

edwardmedia commented May 29, 2020

@Pritilender there is an issue google_project. google_project.foo.id is not good used here for google_project_service. To workaround, you may use below code instead. Please let me know how it works. Thanks

resource "google_project_service" "foo" {
  project = google_project.foo.project_id
  service = "firebase.googleapis.com"
  disable_dependent_services = true
}

@edwardmedia
Copy link
Contributor

@Pritilender Please try to use project_id instead of id in above code. I am closing this issue. Please feel free to reopen it if your problem remains. Thanks

@Pritilender
Copy link
Author

@edwardmedia Sorry for taking me a few days to reply.

Changing id to project_id works! Thank you!

@ghost ghost removed the waiting-response label Jun 2, 2020
@ghost
Copy link

ghost commented Jul 2, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Jul 2, 2020
@github-actions github-actions bot added forward/review In review; remove label to forward service/serviceusage labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
forward/review In review; remove label to forward question service/serviceusage
Projects
None yet
Development

No branches or pull requests

2 participants