Update `vpc` and `eks/cluster` components
What
- Update
vpc
andeks/cluster
components
Why
Use latest module versions
Take into account
var.availability_zones
for the EKS cluster itself. Only thenode-group
module was usingvar.availability_zones
to use the subnets from the provided AZs. The EKS cluster (control plane) was using all the subnets provisioned in a VPC. This caused issues because EKS is not available in all AZs in a region, e.g. it's not available inus-east-1e
b/c of a limited capacity, and when using all AZs fromus-east-1
, the deployment failsThe latest version of the
vpc
component (which was updated in this PR as well) has the outputs to get a map of AZs to the subnet IDs in each AZ
# Get only the public subnets that correspond to the AZs provided in `var.availability_zones`
# `az_public_subnets_map` is a map of AZ names to list of public subnet IDs in the AZs
public_subnet_ids = flatten([for k, v in local.vpc_outputs.az_public_subnets_map : v if contains(var.availability_zones, k)])
# Get only the private subnets that correspond to the AZs provided in `var.availability_zones`
# `az_private_subnets_map` is a map of AZ names to list of private subnet IDs in the AZs
private_subnet_ids = flatten([for k, v in local.vpc_outputs.az_private_subnets_map : v if contains(var.availability_zones, k)])