From 067dbdd2801b48c6043fd3e9c694a4577edc9d78 Mon Sep 17 00:00:00 2001 From: William Date: Mon, 18 Nov 2024 08:26:23 -0600 Subject: [PATCH] Adding access config support to cluster module --- aws/cluster/main.tf | 1 + aws/cluster/modules/eks-cluster/main.tf | 5 +++++ aws/cluster/modules/eks-cluster/variables.tf | 6 ++++++ aws/cluster/variables.tf | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/aws/cluster/main.tf b/aws/cluster/main.tf index 8aa92be6..4577a4f8 100644 --- a/aws/cluster/main.tf +++ b/aws/cluster/main.tf @@ -24,6 +24,7 @@ module "eks_cluster" { public_subnet_ids = module.network.public_subnet_ids tags = var.tags vpc = module.network.vpc + auth_mode = var.auth_mode depends_on = [module.node_role] } diff --git a/aws/cluster/modules/eks-cluster/main.tf b/aws/cluster/modules/eks-cluster/main.tf index 5d8d8131..145c9bd0 100644 --- a/aws/cluster/modules/eks-cluster/main.tf +++ b/aws/cluster/modules/eks-cluster/main.tf @@ -9,6 +9,11 @@ resource "aws_eks_cluster" "this" { tags = var.tags version = var.k8s_version + access_config { + authentication_mode = var.auth_mode + bootstrap_cluster_creator_admin_permissions = true + } + vpc_config { security_group_ids = [aws_security_group.control_plane.id] subnet_ids = concat(var.private_subnet_ids, var.public_subnet_ids) diff --git a/aws/cluster/modules/eks-cluster/variables.tf b/aws/cluster/modules/eks-cluster/variables.tf index 7d3a611c..cfbb5e72 100644 --- a/aws/cluster/modules/eks-cluster/variables.tf +++ b/aws/cluster/modules/eks-cluster/variables.tf @@ -46,3 +46,9 @@ variable "vpc" { type = object({ id = string }) description = "VPC in which this cluster should run" } + +variable "auth_mode" { + type = string + description = "Authentiation mode associated with the cluster Access config" + default = "API_AND_CONFIG_MAP" +} diff --git a/aws/cluster/variables.tf b/aws/cluster/variables.tf index f868f4a8..65bcc44e 100644 --- a/aws/cluster/variables.tf +++ b/aws/cluster/variables.tf @@ -41,3 +41,9 @@ variable "tags" { description = "Tags to be applied to all created resources" default = {} } + +variable "auth_mode" { + type = string + description = "Authentiation mode associated with the cluster Access config" + default = "API_AND_CONFIG_MAP" +} \ No newline at end of file