mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-15 16:23:58 +01:00
51 lines
1.6 KiB
HCL
51 lines
1.6 KiB
HCL
resource "aws_eks_node_group" "workers" {
|
|
for_each = local.node_groups_expanded
|
|
|
|
node_group_name = lookup(each.value, "name", join("-", [var.cluster_name, each.key, random_pet.node_groups[each.key].id]))
|
|
|
|
cluster_name = var.cluster_name
|
|
node_role_arn = each.value["iam_role_arn"]
|
|
subnet_ids = each.value["subnets"]
|
|
|
|
scaling_config {
|
|
desired_size = each.value["desired_capacity"]
|
|
max_size = each.value["max_capacity"]
|
|
min_size = each.value["min_capacity"]
|
|
}
|
|
|
|
ami_type = lookup(each.value, "ami_type", null)
|
|
disk_size = lookup(each.value, "disk_size", null)
|
|
instance_types = [each.value["instance_type"]]
|
|
release_version = lookup(each.value, "ami_release_version", null)
|
|
|
|
dynamic "remote_access" {
|
|
for_each = each.value["key_name"] != "" ? [{
|
|
ec2_ssh_key = each.value["key_name"]
|
|
source_security_group_ids = lookup(each.value, "source_security_group_ids", [])
|
|
}] : []
|
|
|
|
content {
|
|
ec2_ssh_key = remote_access.value["ec2_ssh_key"]
|
|
source_security_group_ids = remote_access.value["source_security_group_ids"]
|
|
}
|
|
}
|
|
|
|
version = lookup(each.value, "version", null)
|
|
|
|
labels = merge(
|
|
lookup(var.node_groups_defaults, "k8s_labels", {}),
|
|
lookup(var.node_groups[each.key], "k8s_labels", {})
|
|
)
|
|
|
|
tags = merge(
|
|
var.tags,
|
|
lookup(var.node_groups_defaults, "additional_tags", {}),
|
|
lookup(var.node_groups[each.key], "additional_tags", {}),
|
|
)
|
|
|
|
lifecycle {
|
|
create_before_destroy = true
|
|
ignore_changes = [scaling_config.0.desired_size]
|
|
}
|
|
}
|