Our company is splitting into two organizations. We’re using Terraform open source and need to make a copy of the Terraform code to use for the new organization. The new organization will not need several of the existing projects and will need a new project to be created. Then there are several existing projects that need to be migrated over in GCP to the new organization.
I’m wondering how we would go about accomplishing this. Would we do something like the following:
- Bootstrap the new organization outside Terraform or use a separate TF to bootstrap the org.
- Copy the Terraform Code to be used for the new org (update the org id) and don’t copy the state file
- Run the TF code in the new organization, which will create a new state file
- In TF, delete the projects that aren’t needed and create the new project in TF. Run TF apply.
- Delete the projects in the GCP console that need to be migrated from the first org and migrate those projects manually.
- Somehow associate the state file with the projects that were just migrated. Since the project IDs are the same after the migration, I don’t know if anything needs to be modified in the state file.
- Run TF apply