From 1950b5a1c954678ba62b28ad733bde41bd236bc2 Mon Sep 17 00:00:00 2001 From: Drew Meyers Date: Thu, 29 Feb 2024 08:47:59 -0800 Subject: [PATCH] Parameterize node group inputs --- .../modules/terraform-eks-cluster/README.md | 3 ++- .../modules/terraform-eks-cluster/main.tf | 12 +++--------- .../modules/terraform-eks-cluster/variables.tf | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/terraform-unity/modules/terraform-eks-cluster/README.md b/terraform-unity/modules/terraform-eks-cluster/README.md index 421c19f..1c7ccf7 100644 --- a/terraform-unity/modules/terraform-eks-cluster/README.md +++ b/terraform-unity/modules/terraform-eks-cluster/README.md @@ -19,7 +19,7 @@ | Name | Source | Version | |------|--------|---------| -| [unity-eks](#module\_unity-eks) | git@github.com:unity-sds/unity-cs-infra.git//terraform-unity-eks_module | 0.1.3 | +| [unity-eks](#module\_unity-eks) | git@github.com:unity-sds/unity-cs-infra.git//terraform-unity-eks_module | 8-launch-template-hop-limit | ## Resources @@ -35,6 +35,7 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [cluster\_name](#input\_cluster\_name) | n/a | `string` | n/a | yes | +| [nodegroups](#input\_nodegroups) | A map of node group configurations |
map(object({
instance_types = list(string)
min_size = number
max_size = number
desired_size = number
}))
|
{
"defaultGroup": {
"desired_size": 1,
"instance_types": [
"m5.xlarge"
],
"max_size": 1,
"min_size": 1
}
}
| no | ## Outputs diff --git a/terraform-unity/modules/terraform-eks-cluster/main.tf b/terraform-unity/modules/terraform-eks-cluster/main.tf index 3b96d9d..37376b8 100644 --- a/terraform-unity/modules/terraform-eks-cluster/main.tf +++ b/terraform-unity/modules/terraform-eks-cluster/main.tf @@ -1,15 +1,9 @@ module "unity-eks" { - source = "git@github.com:unity-sds/unity-cs-infra.git//terraform-unity-eks_module?ref=0.1.3" + source = "git@github.com:unity-sds/unity-cs-infra.git//terraform-unity-eks_module?ref=8-launch-template-hop-limit" deployment_name = var.cluster_name - nodegroups = { - defaultGroup = { - instance_types = ["m5.xlarge"] - min_size = 1 - max_size = 1 - desired_size = 1 - } - } + nodegroups = var.nodegroups + aws_auth_roles = [{ rolearn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/mcp-tenantOperator" username = "admin" diff --git a/terraform-unity/modules/terraform-eks-cluster/variables.tf b/terraform-unity/modules/terraform-eks-cluster/variables.tf index abbf86f..9eb338e 100644 --- a/terraform-unity/modules/terraform-eks-cluster/variables.tf +++ b/terraform-unity/modules/terraform-eks-cluster/variables.tf @@ -1,3 +1,21 @@ variable "cluster_name" { type = string } + +variable "nodegroups" { + description = "A map of node group configurations" + type = map(object({ + instance_types = list(string) + min_size = number + max_size = number + desired_size = number + })) + default = { + defaultGroup = { + instance_types = ["m5.xlarge"] + min_size = 1 + max_size = 1 + desired_size = 1 + } + } +}