2

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.

PjoterS
  • 12,841
  • 1
  • 22
  • 54
Adam Briers
  • 101
  • 3
  • 14
  • How many GCP Repo do you have? One for all projects, each project has its own? This error 409 started to happen when you removed an old project? What happens if you change the name, you will be able to push it? Could you rephrase your whole scenario? Pimmstest was in the production folder and then was moved to the test folder, pushed this code and then removed this test? – PjoterS Nov 12 '21 at 10:18
  • Hi ok we have 3 folders under one org - Production, Test and R&D. We discovered that one project (pimsstest) was created in the wrong folder (production) so i moved it into test and pushed out the changes via vs code. Under test we also have an old dataflow project that's no longer needed so i originally just blocked this by adding .bck to all the terragrunt files. When i re-pushed it, it fails and the cloud build log tells me that pimsstest already exists? – Adam Briers Nov 17 '21 at 16:19
  • If i remove the .bck from the dataflow project to make it live again and repush, the error goes away. I am stumped as to why removing an unrelated project can have this knock on effect to another project i previously moved from another folder – Adam Briers Nov 17 '21 at 16:19

2 Answers2

3

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.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • thanks i got the same issue after unsuccessful 'terragrunt apply's. i was debugging and somehow the partially created project from previous tests resulted in the new one not being able to recreate – raphael.oester Mar 24 '23 at 10:52
0

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

Mithun Biswas
  • 1,617
  • 1
  • 12
  • 19