resource “azurerm_resource_group” “kubernetes” {
name = var.resource_group_name
location = “North Europe”
}
resource “azurerm_kubernetes_cluster” “kubernetes” {
name = var.cluster_name
location = azurerm_resource_group.kubernetes.location
resource_group_name = azurerm_resource_group.kubernetes.name
dns_prefix = var.cluster_name
kubernetes_version = var.azurerm_kubernetes_cluster_kubernetes_version
node_resource_group = var.env == “staging-old”? var.azurerm_node_resource_group_kubernetes_name : null
role_based_access_control_enabled = false
azure_policy_enabled = false
linux_profile {
admin_username = “energia”
ssh_key {
key_data = file(“${path.module}/ssh/id_rsa.pub”)
}
}
default_node_pool {
name = “default”
type = var.node_pool_type
node_count = var.azurerm_kubernetes_cluster_default_node_pool_node_count
vm_size = var.azurerm_kubernetes_cluster_default_node_pool_vm_size
os_disk_size_gb = var.azurerm_kubernetes_cluster_default_node_pool_os_disk_size_gb
vnet_subnet_id = var.azurerm_subnet_aks_id
max_pods = var.azurerm_kubernetes_cluster_max_pods
ultra_ssd_enabled = var.ultra_ssd_enabled
temporary_name_for_rotation = var.env == “staging-new” ? “k8snodepool”: null
zones = var.env == “staging-new” ? [“1”, “2”, “3”] : null
}
network_profile {
network_plugin = “azure”
load_balancer_sku = var.load_balancer_sku
network_plugin_mode = var.network_plugin_mode
network_policy = var.network_policy
ebpf_data_plane = var.env == “staging-new” ? “cilium”: null
}
identity {
type = “SystemAssigned”
}
oidc_issuer_enabled = var.oidc_issuer_enabled
workload_identity_enabled = var.workload_identity_enabled
tags = {
environment = “${var.env}”
}
}