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

Allow import of GCP projects #138

Closed
ensslen opened this issue Jan 30, 2019 · 7 comments · Fixed by #332
Closed

Allow import of GCP projects #138

ensslen opened this issue Jan 30, 2019 · 7 comments · Fixed by #332
Assignees
Labels
enhancement New feature or request P2 high priority issues triaged Scoped and ready for work

Comments

@ensslen
Copy link

ensslen commented Jan 30, 2019

GCP project names can not be reused, attempting to do so results in a 409 error. However, this module won't accept an imported project, e.g. terraform import module.X.google_project.main my-project, because id and project_id can not be supplied as inputs. The imported project results in

-/+ module.my-project.google_project.main (new resource required)
id: "my-project-name" => (forces new resource)
auto_create_network: "true" => "false"
billing_account: "XXXXX-XXXXX-XXXXX" => "XXXXX-XXXXX-XXXXX"
folder_id: "" =>
name: "my-project-name" => "my-project-name"
number: "808999117972" =>
org_id: "1234567890" => "1234567890"
policy_data: "" =>
policy_etag: "" =>
project_id: "my-project-name" => "${local.temp_project_id}" (forces new resource)
skip_delete: "" =>

@aaron-lane
Copy link
Contributor

Hi @ensslen. Thank you for your interest in the project! I apologize for the extreme delay in responding.

Since project-factory v2.1, project_id is an optional variable, but that only solves part of this problem as the ultimate value passed to the google_project has sufficient interpolation complexity to cause an imported project to be recreated even when its ID is provided as an input. We are investigating moving the complexity around the project ID calculation out of the core-project-factory submodule which should allow you to invoke that submodule directly with an imported project.

@aaron-lane aaron-lane added the enhancement New feature or request label May 27, 2019
@nicobrinkkemper
Copy link

Can I fill in a existing project name without fear of losing the name? I fear it will be deleted and then won't be able to use that name anymore.

@aaron-lane
Copy link
Contributor

@nicobrinkkemper support is not in place for importing existing projects.

@cochrasc
Copy link

Any idea on when an import feature may be added? I ran into an issue while using non-random project names where the project was created, but the state file was not updated (caused by network issues). This resulted in me not being able to use the project name any more, and is causing much pain for my customers. I undeleted the project, but can't get it into the state file, and is making using terraform a real obstacle at this point. Thanks!

@morgante
Copy link
Contributor

@cochrasc What happens if you attempt to import using terraform import?

@aaron-lane aaron-lane added the triaged Scoped and ready for work label Nov 29, 2019
@aaron-lane
Copy link
Contributor

We should ensure that at least the core_project_factory submodule can be used with an imported project. If the root module, shared_vpc submodule, and gsuite_enabled submodules can be used with an imported project, that will be a bonus.

@aaron-lane aaron-lane added P2 high priority issues triaged Scoped and ready for work and removed triaged Scoped and ready for work labels Dec 3, 2019
@paulpalamarchuk paulpalamarchuk self-assigned this Dec 10, 2019
paulpalamarchuk added a commit to paulpalamarchuk/terraform-google-project-factory that referenced this issue Dec 11, 2019
paulpalamarchuk added a commit to paulpalamarchuk/terraform-google-project-factory that referenced this issue Dec 11, 2019
@paulpalamarchuk
Copy link
Contributor

@aaron-lane I've tested imports with main module, core_project_factory and shared_vpc submodules. Works fine.

paulpalamarchuk added a commit to paulpalamarchuk/terraform-google-project-factory that referenced this issue Dec 11, 2019
paulpalamarchuk added a commit to paulpalamarchuk/terraform-google-project-factory that referenced this issue Dec 11, 2019
paulpalamarchuk added a commit to paulpalamarchuk/terraform-google-project-factory that referenced this issue Dec 11, 2019
aaron-lane added a commit that referenced this issue Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 high priority issues triaged Scoped and ready for work
Projects
None yet
7 participants