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 creating project xxxx: googleapi: Error 409: Requested entity already exists #10267

Closed
lcoupe opened this issue Oct 6, 2021 · 4 comments
Assignees
Labels

Comments

@lcoupe
Copy link

lcoupe commented Oct 6, 2021

Hi there,

I am trying to deploy a new project via Terraform into GCP - the project definitely doesn't already exist - however, Terraform is reporting it does and failing to apply.

However, if I change the project name it works...

Folder ID and Billing Account are correct - as it works with an alternative project id...

It's almost like something is hanging around in the state - however, I have checked this...

Terraform Version

0.15

Google Provider Version

3.67.0

Terraform Configuration Files

resource "google_project" "project" {
  count               = var.stage == "stage" ? 1 : 0
  provider            = google.impersonated
  name                = var.project_id
  project_id          = var.project_id
  folder_id           = var.parent_folder_id
  auto_create_network = false

  billing_account = var.billing_account_id
}

Debug Output

Crash Output

google_project.project[0]: Creating...
╷
│ Error: error creating project xxxx (xxxx): googleapi: Error 409: Requested entity already exists, alreadyExists. If you received a 403 error, make sure you have the `roles/resourcemanager.projectCreator` permission
│
│   on project.tf line 3, in resource "google_project" "project":
│    3: resource "google_project" "project" {
│
╵

Expected Behavior

The project should be created with the desired project id

Actual Behavior

Terraform crashes and reports the requested entity already exists
@lcoupe lcoupe added the bug label Oct 6, 2021
@edwardmedia edwardmedia self-assigned this Oct 6, 2021
@edwardmedia
Copy link
Contributor

@lcoupe The error indicates either the project_id already exists or the terraform runner does not have permission to create a new project. But from what you described, it is neither. I need more info before I can say. To debug, can you repro the issue after removing the dynamic code? If yes, can you share the config?

@edwardmedia
Copy link
Contributor

@lcoupe is this still an issue?

@edwardmedia
Copy link
Contributor

@lcoupe closing assuming this is no longer an issue

@github-actions
Copy link

github-actions bot commented Dec 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 Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants