diff --git a/modules/kubernetes-cluster/CHANGELOG.md b/modules/kubernetes-cluster/CHANGELOG.md index 825c32f..5466a3f 100644 --- a/modules/kubernetes-cluster/CHANGELOG.md +++ b/modules/kubernetes-cluster/CHANGELOG.md @@ -1 +1,4 @@ # Changelog + +## 1.1 +* Added `node_resource_group_id` output. diff --git a/modules/kubernetes-cluster/README.md b/modules/kubernetes-cluster/README.md index 52e0b49..bae8331 100644 --- a/modules/kubernetes-cluster/README.md +++ b/modules/kubernetes-cluster/README.md @@ -8,14 +8,15 @@ This module creates a [Kubernetes Cluster](https://registry.terraform.io/provide module "kubernetes_cluster" { source = "https://github.com/gofrontier-com/azurerm-terraform-modules/releases/download/kubernetes-cluster/[VERSION]/module.tar.gz//src" - environment = "dev" - identifier = "mortgages" + environment = "dev" + identifier = "creditcards" + location = "uksouth" + resource_group_name = module.resource_group.name + zone = "cus" + kubernetes_version = "1.28.1" - location = "uksouth" log_analytics_workspace_id = data.azurerm_log_analytics_workspace.main.id - resource_group_name = module.resource_group.name subnet_id = data.azurerm_subnet.k8s.id - zone = "shd" tags = { WorkloadType = "CustomerBankingLZ/container-platform" diff --git a/modules/kubernetes-cluster/VERSION b/modules/kubernetes-cluster/VERSION index d3827e7..9459d4b 100644 --- a/modules/kubernetes-cluster/VERSION +++ b/modules/kubernetes-cluster/VERSION @@ -1 +1 @@ -1.0 +1.1 diff --git a/modules/kubernetes-cluster/src/main.tf b/modules/kubernetes-cluster/src/main.tf index ed26fd0..5879ef4 100644 --- a/modules/kubernetes-cluster/src/main.tf +++ b/modules/kubernetes-cluster/src/main.tf @@ -27,15 +27,24 @@ resource "azurerm_kubernetes_cluster" "main" { vnet_subnet_id = var.subnet_id zones = var.zones + upgrade_settings { + max_surge = "10%" + } + tags = merge(var.tags, local.tags) } - api_server_access_profile { - authorized_ip_ranges = var.authorized_ip_ranges + dynamic "api_server_access_profile" { + for_each = length(var.authorized_ip_ranges) > 0 ? [{}] : [] + + content { + authorized_ip_ranges = var.authorized_ip_ranges + } } identity { - type = "SystemAssigned" + type = "SystemAssigned" + identity_ids = [] } key_vault_secrets_provider { diff --git a/modules/kubernetes-cluster/src/outputs.tf b/modules/kubernetes-cluster/src/outputs.tf index d1929e4..8e3b204 100644 --- a/modules/kubernetes-cluster/src/outputs.tf +++ b/modules/kubernetes-cluster/src/outputs.tf @@ -22,3 +22,7 @@ output "kube_config" { output "node_resource_group" { value = azurerm_kubernetes_cluster.main.node_resource_group } + +output "node_resource_group_id" { + value = "${split(var.resource_group_name, azurerm_kubernetes_cluster.main.id)[0]}${azurerm_kubernetes_cluster.main.node_resource_group}" +} diff --git a/modules/kubernetes-cluster/test/main.tf b/modules/kubernetes-cluster/test/main.tf index b7b8b6d..55a4209 100644 --- a/modules/kubernetes-cluster/test/main.tf +++ b/modules/kubernetes-cluster/test/main.tf @@ -5,14 +5,15 @@ provider "azurerm" { module "kubernetes_cluster" { source = "../src" - environment = "foo" - identifier = "bar" + environment = "foo" + identifier = "bar" + location = "uksouth" + resource_group_name = "qux" + zone = "corge" + kubernetes_version = "1.2.3" - location = "uksouth" log_analytics_workspace_id = "baz" - resource_group_name = "qux" subnet_id = "quux" - zone = "corge" tags = { Foo = "Bar"