From 3d9c5d381cbed6c6062ea4521a786fce0527498c Mon Sep 17 00:00:00 2001 From: Jeff Owens Date: Mon, 21 Nov 2022 12:22:46 -0500 Subject: [PATCH] feat: (IAC-639): add aks_cluster_sku_tier variable to aks module --- docs/CONFIG-VARS.md | 1 + main.tf | 1 + modules/azure_aks/main.tf | 1 + modules/azure_aks/variables.tf | 10 ++++++++++ variables.tf | 11 +++++++++++ 5 files changed, 24 insertions(+) diff --git a/docs/CONFIG-VARS.md b/docs/CONFIG-VARS.md index 579328d3..b8681d8b 100644 --- a/docs/CONFIG-VARS.md +++ b/docs/CONFIG-VARS.md @@ -173,6 +173,7 @@ Ubuntu 20.04 LTS is the operating system used on the Jump/NFS servers. Ubuntu cr | aks_identity | Use UserAssignedIdentity or Service Principal as [AKS identity](https://docs.microsoft.com/en-us/azure/aks/concepts-identity) | string | "uai" | A value of `uai` wil create a Managed Identity based on the permissions of the authenticated user or use [`AKS_UAI_NAME`](#use-existing), if set. A value of `sp` will use values from [`CLIENT_ID`/`CLIENT_SECRET`](#azure-authentication), if set. | | ssh_public_key | File name of public ssh key for jump and nfs VM | string | "~/.ssh/id_rsa.pub" | Required with `create_jump_vm=true` or `storage_type=standard` | | cluster_api_mode | Public or private IP for the cluster api | string | "public" | Valid Values: "public", "private" | +| aks_cluster_sku_tier | Optimizes api server for cost vs availability | string | "Free" | Valid Values: "Free", "Paid" | ## Node Pools diff --git a/main.tf b/main.tf index 3b6fa89d..8d7b4323 100644 --- a/main.tf +++ b/main.tf @@ -130,6 +130,7 @@ module "aks" { aks_cluster_rg = local.aks_rg.name aks_cluster_rg_id = local.aks_rg.id aks_cluster_dns_prefix = "${var.prefix}-aks" + aks_cluster_sku_tier = var.aks_cluster_sku_tier aks_cluster_location = var.location aks_cluster_node_auto_scaling = var.default_nodepool_min_nodes == var.default_nodepool_max_nodes ? false : true aks_cluster_node_count = var.default_nodepool_min_nodes diff --git a/modules/azure_aks/main.tf b/modules/azure_aks/main.tf index 4172da26..4c1147ba 100644 --- a/modules/azure_aks/main.tf +++ b/modules/azure_aks/main.tf @@ -4,6 +4,7 @@ resource "azurerm_kubernetes_cluster" "aks" { location = var.aks_cluster_location resource_group_name = var.aks_cluster_rg dns_prefix = var.aks_cluster_dns_prefix + sku_tier = var.aks_cluster_sku_tier role_based_access_control_enabled = true http_application_routing_enabled = false diff --git a/modules/azure_aks/variables.tf b/modules/azure_aks/variables.tf index 4a62a228..d850c87d 100644 --- a/modules/azure_aks/variables.tf +++ b/modules/azure_aks/variables.tf @@ -9,6 +9,16 @@ variable "aks_cluster_location" { default = "eastus" } +variable aks_cluster_sku_tier { + description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are Free and Paid (which includes the Uptime SLA). Defaults to Free" + default = "Free" + + validation { + condition = contains(["Free", "Paid"], var.aks_cluster_sku_tier) + error_message = "ERROR: Valid types are \"Free\" and \"Paid\"!" + } +} + variable "aks_private_cluster" { default = false } diff --git a/variables.tf b/variables.tf index 2638eda9..0b797ac5 100644 --- a/variables.tf +++ b/variables.tf @@ -41,6 +41,17 @@ variable "location" { default = "eastus" } +variable aks_cluster_sku_tier { + description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are Free and Paid (which includes the Uptime SLA). Defaults to Free" + default = "Free" + type = string + + validation { + condition = contains(["Free", "Paid"], var.aks_cluster_sku_tier) + error_message = "ERROR: Valid types are \"Free\" and \"Paid\"!" + } +} + variable "ssh_public_key" { type = string default = "~/.ssh/id_rsa.pub"