Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable EKS Worker Dedicated Tenancy #1388

Merged
merged 16 commits into from
Feb 11, 2023
Merged
8 changes: 8 additions & 0 deletions examples/node-groups/self-managed-node-groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ module "eks_blueprints" {
node_group_name = "self_mg4"
launch_template_os = "amazonlinux2eks"
subnet_ids = module.vpc.private_subnets

placement = {
affinity = null
availability_zone = null
group_name = null
host_id = null
tenancy = "dedicated"
}
}
self_mg5 = {
node_group_name = "self_mg5" # Name is used to create a dedicated IAM role for each node group and adds to AWS-AUTH config map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module "launch_template_self_managed_ng" {
http_put_response_hop_limit = try(var.self_managed_ng.http_put_response_hop_limit, 2)
http_protocol_ipv6 = try(var.self_managed_ng.http_protocol_ipv6, null)
instance_metadata_tags = try(var.self_managed_ng.instance_metadata_tags, null)
placement = try(var.self_managed_ng.placement, null)

service_ipv6_cidr = var.context.service_ipv6_cidr
service_ipv4_cidr = var.context.service_ipv4_cidr
Expand Down
11 changes: 11 additions & 0 deletions modules/launch-templates/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ resource "aws_launch_template" "this" {
}
}

dynamic "placement" {
for_each = try(each.value.placement, null) != null ? [each.value.placement] : []
content {
affinity = lookup(placement.value, "affinity", null)
availability_zone = lookup(placement.value, "availability_zone", null)
group_name = lookup(placement.value, "group_name", null)
host_id = lookup(placement.value, "host_id", null)
tenancy = lookup(placement.value, "tenancy", null)
}
}

vpc_security_group_ids = try(each.value.vpc_security_group_ids, null)

dynamic "network_interfaces" {
Expand Down