- Set AWS Provider Config
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_KEY=""
export AWS_REGION=""
- Move into aws dir
cd aws
- Set variables
touch terraform.tfvars
Add variables to terraform.tfvars
name = "terraform"
path = "/"
- Init
terraform init
- Import AWS IAM User
terraform import aws_iam_user.user terraform
- Run a plan to make sure no changes are detected
terraform plan
- Set GCP Provider Config
export GOOGLE_PROJECT=""
export GOOGLE_APPLICATION_CREDENTIALS=""
- Move into gcp dir
cd gcp
- Set variables
touch terraform.tfvars
Add variables to terraform.tfvars
account_id = "terraform@testing-2...."
display_name = "terraform"
- Init
terraform init
- Import GCP Service Account
terraform import google_service_account.sa terraform@testing-2....
- Run a plan to make sure no changes are detected
terraform plan
- Move AWS State
terraform state mv -state=aws/terraform.tfstate -state-out=combined/terraform.tfstate "aws_iam_user.user" "aws_iam_user.user"
- Move GCP State
terraform state mv -state=gcp/terraform.tfstate -state-out=combined/terraform.tfstate "google_service_account.sa" "google_service_account.sa"
- Move into combined dir
cd combined
- Init
terraform init
- Run a plan to make sure no changes are detected
terraform plan