Spread terraform EKS nodes across available subnets on AWS

Viewed 21

I have an EKS set up with multiple node groups. One node group has access to 3 subnets. When I create 5 nodes in that group, these nodes are all added to a single subnet only. Sometimes when I destroy and recreate the EKS, one node may be added to one of the other 2 subnets. I understand this is pretty standard (using terraform aws eks).

My question is, would it be possible to extend the terraform module to force a more even spread of the node across available subnets? So if we have 5 nodes with 3 available subnets, we'd want 2 nodes on subnet-1, 2 on subnet-2 and 1 on subnet-3. Would this be doable?

0 Answers
Related