Adam Briers
Adam Briers

Reputation: 101

Google Cloud platform terraform/terragrunt googleapi: Error 409: Requested entity already exist

I am having a strange issue when trying to push code out to our gcp repo. It fails with the following error "googleapi: Error 409: Requested entity already exists, alreadyExists" and it is referring to a project that already exists() This only occurs after i either remove another project that's no longer needed or add .bck to the terragrunt.hcl files. These projects have no dependancies on each other whatsoever.

terraform {
source = "../../../modules//project/"
}

include {
 path = find_in_parent_folders("org.hcl")
}

dependency "folder" {
config_path = "../"

 # Configure mock outputs for the terraform commands that are returned when there are no 
 outputs available (e.g the
# module hasn't been applied yet.
mock_outputs_allowed_terraform_commands = ["plan", "validate"]
mock_outputs = {
folder_id = "folder-not-created-yet"
}
}

inputs = {
project_name       = "<pimsstest-project>"
folder_id          = dependency.folder.outputs.folder_created # Test folder id
is_service_project = true

code push will fail with the structure in VS code is like this:

enter image description here

But it succeeds when like this

enter image description here

Some background to add. Pimsstest used to exist in a production folder under org and i moved it to test via vs code with a simple cut and paste and re push of code. I then removed the project from the console as it still existed in production. I cannot work out why the removal of another project will flag up this existing error message on pimsstest. It doesn't make any sense to me.

Upvotes: 2

Views: 14199

Answers (2)

Mithun Biswas
Mithun Biswas

Reputation: 1833

the gcp project id has to be unique globally. Creating and managing projects

Upvotes: 1

Martin Zeitler
Martin Zeitler

Reputation: 76779

Across GCP a project ID can exist once only. Upon removal, it might not be instantly available again (it will always have status "scheduled for removal" - and you should receive an email, with the details of the scheduled operation). What the error message actually is trying to tell may be:

Error 409: Requested entity already STILL exist.

In theory (even if it's unlikely, when the name is unique enough), any other customer could snatch the name in the meanwhile - in which case the error message could be literally understood.

Upvotes: 3

Related Questions