Let’s say I have 2 modules:
- AWS VPC - Creates a VPC, subnets, etc.
- AWS EKS - Creates an EKS cluster in given VPC
In some situations, there is already a VPC and I want to only use the EKS module. I’ve supported this situation in two different ways.
Scenario 1: Import the preexisting VPC into the VPC module, requires a lot of iteration getting it to all match after the import.
Scenario 2: Don’t use the VPC module at all, pass the preexisting VPC ID, Subnet IDs, etc. to the EKS module.
In this situation, Scenario 2 worked out great. I never tried Scenario 1.
New project, new problems.
In a similar situation, I have 2 modules:
- Azure Storage - Creates storage account, creates Azure File systems.
- Azure AKS - Creates an AKS cluster, using the given storage account.
For a new environment I’d run both modules, no problem there. Once again, in some cases we’re migrating preexisting clusters + storage accounts into Terraform control.
With this one I’m leaning more towards importing because we do sometimes make changes to the storage resources.
What do you guys think?