Hi,
I've inherited a large AWS implementation, and trying to bring it under Terraform management. The resources are split into six environments (eg dev, test, qa, training, pre-prod and prod) by an environment tag. Importing must be done resource by resource, so as it's my first attempt, I would like to validate the iterative process of:
1. terraform import
2. write terraform code describing each resource
3. terraform plan
until terraform plan reports nothing will be deleted\changed. I understand this approach is best practice until terraform import can write the code rather than just populate the state file. My question: since I have a large quantity of resources, I would like to do this environment by environment starting with dev. This allows me to split my code logically by environment. What will happen if I import all the dev resources, I write terraform code until terraform plan reports nothing will be deleted\changed, and then run terraform apply? Will terraform ignore the other environments' resources because they're not in its state (not imported), and leave them intact? Or will it import everything during the apply run, think everything except dev resources are anomalous and delete them?
I really don't want to get this wrong, accidentally delete everything (except dev) and re-implement.
Many thanks