diff --git a/README.md b/README.md index 0157102..9b59b4d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The module deploys Karpenter needed AWS resources, namely in IAM. It copies the | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13 | -| [aws](#requirement\_aws) | >= 5.14.0 | +| [aws](#requirement\_aws) | >= 6.0 | | [helm](#requirement\_helm) | >= 2.11.0 | | [null](#requirement\_null) | >= 3.2.1 | @@ -26,9 +26,9 @@ The module deploys Karpenter needed AWS resources, namely in IAM. It copies the | Name | Version | |------|---------| -| [aws](#provider\_aws) | 6.15.0 | -| [aws.eecr](#provider\_aws.eecr) | 6.15.0 | -| [helm](#provider\_helm) | 3.0.2 | +| [aws](#provider\_aws) | 6.33.0 | +| [aws.eecr](#provider\_aws.eecr) | 6.33.0 | +| [helm](#provider\_helm) | 3.1.1 | | [null](#provider\_null) | 3.2.4 | ## Modules @@ -69,7 +69,7 @@ The module deploys Karpenter needed AWS resources, namely in IAM. It copies the | [oidc\_provider\_arn](#input\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | `string` | `""` | no | | [profile](#input\_profile) | AWS config profile | `string` | `""` | no | | [region](#input\_region) | AWS region | `string` | n/a | yes | -| [subnets\_name](#input\_subnets\_name) | Define the name of the subnets to be used by this cluster | `string` | `"*-container-*"` | no | +| [subnets](#input\_subnets) | Subnet IDs used to derive a subnet Name tag (optional) | `list(string)` | `[]` | no | | [tags](#input\_tags) | AWS Tags to apply to appropriate resources | `map(string)` | `{}` | no | ## Outputs diff --git a/karpenter-resources/values.yaml.tpl b/karpenter-resources/values.yaml.tpl index c4004b1..983f361 100644 --- a/karpenter-resources/values.yaml.tpl +++ b/karpenter-resources/values.yaml.tpl @@ -9,8 +9,7 @@ ec2NodeClass: amiSelectorTerms: - alias: ${amd_ami_alias} subnetSelectorTerms: - - tags: - Name: "${subnets_name}" +${subnets} securityGroupSelectorTerms: - tags: Name: "${cluster_name}-node" @@ -42,9 +41,9 @@ nodePool: disruption: consolidationPolicy: "WhenEmptyOrUnderutilized" consolidateAfter: "5m" - limits: - cpu: "1000" - memory: 1000Gi + # limits: + # cpu: "1000" + # memory: 1000Gi weight: 1 labels: {} taints: [] diff --git a/main.tf b/main.tf index ca83033..bfdc816 100644 --- a/main.tf +++ b/main.tf @@ -16,6 +16,8 @@ locals { max_rule_name_length = 8 rule_name_prefix = length(local.rule_name_raw) > local.max_rule_name_length ? substr(local.rule_name_raw, 0, local.max_rule_name_length) : local.rule_name_raw queue_name = format("%v%v", local.prefixes["eks-queue"], var.cluster_name) + subnet_ids = try(tolist(var.subnets), []) + } # Replicating from here: https://github.e.it.census.gov/SCT-Engineering/terraform-aws-eks/tree/master/modules/karpenter @@ -103,7 +105,7 @@ resource "helm_release" "nodepool_resources" { amd_ami_family = local.amd_ami_family cluster_name = var.cluster_name karpenter_node_profile = module.karpenter_resources.instance_profile_name - subnets_name = var.subnets_name + subnets = join("\n", [for id in local.subnet_ids : " - id: ${id}"]) tags = var.tags }) ] diff --git a/requirements.tf b/requirements.tf index 5cd741d..0b39eae 100644 --- a/requirements.tf +++ b/requirements.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.14.0" + version = ">= 6.0" } helm = { source = "hashicorp/helm" diff --git a/variables.tf b/variables.tf index d2bb162..98c5fd5 100644 --- a/variables.tf +++ b/variables.tf @@ -80,10 +80,10 @@ variable "region" { type = string } -variable "subnets_name" { - description = "Define the name of the subnets to be used by this cluster" - type = string - default = "*-container-*" +variable "subnets" { + description = "Subnet IDs used to derive a subnet Name tag (optional)" + type = list(string) + default = [] } variable "tags" {