Project migration between GCP organizations
Once in a while, you may find yourself in a situation where you have to move projects between Google Cloud organizations. There are multiple reasons, maybe the company where you are working needs the infrastructure that is hosted in a project outside of your main organization.
So here you will find the necessary steps to move projects from organization one to organization two.
It is assumed that you have already checked all the roles and resources each project has. Also, you are aware that if there is any shared VPC between the GCP projects that you want to move the procedure will require more work that is not covered here.
Organization One: Where the projects come from
Organization Two: Destination organization
Role configuration
The person or group of people who are responsible for the migration must have the following roles and permissions. The roles and permissions differ from parent organization to destination organization
You have to use this command to create the role:
gcloud iam roles create CloudDeployRole --project={PROJECT_CODE} --file=CUSTOM_ROLE.yml
Here you have the specific roles needed
Constraint configuration
On the parent and destination organization, you must allow the export and import of resources. You have to configure this on “Organization Policies”.
To perform this configuration you MUST have the Organization Policy Administrator role.
Then you can go to:
IAM & Admin > Organization Policies > [Choose the policy you want edit] > Edit
Constraints:
On the following constraint you have to grant access to the parent organization.
ID: constraints/resourcemanager.allowedExportDestinations
Name: Allowed Destinations for Exporting Resources
On the following constraint you have to grant access to the destination organization.
ID: constraints/resourcemanager.allowedImportSources
Name: Allowed Sources for Importing Resources
Migration
Finally, in order to migrate the project or projects, you have to run the following command from the command line of any project inside your organization.
gcloud beta projects move {ORIGIN PROJECT} --folder {DESTINATION FOLDER}
For further and more detailed information refer to the following link: