@@ -58,6 +58,22 @@ resource "azurerm_role_assignment" "monitoring_reader" {
5858 depends_on = [ azurerm_user_assigned_identity . capz_monitoring_user_identity ]
5959}
6060
61+ # lookups for AKS-created user assigned identities and DNS zone (do not create new identities)
62+ data "azurerm_user_assigned_identity" "aks_akv" {
63+ name = " azurekeyvaultsecretsprovider-capz-monitoring"
64+ resource_group_name = " MC_capz-monitoring_capz-monitoring_eastus"
65+ }
66+
67+ data "azurerm_user_assigned_identity" "aks_webapp" {
68+ name = " webapprouting-capz-monitoring"
69+ resource_group_name = " MC_capz-monitoring_capz-monitoring_eastus"
70+ }
71+
72+ data "azurerm_dns_zone" "capz_monitoring" {
73+ name = " capz-monitoring.org"
74+ resource_group_name = " capz-monitoring"
75+ }
76+
6177resource "azurerm_kubernetes_cluster" "capz-monitoring" {
6278 dns_prefix = local. computed_dns_prefix
6379 location = var. location
@@ -82,15 +98,39 @@ resource "azurerm_kubernetes_cluster" "capz-monitoring" {
8298 azurerm_user_assigned_identity . capz_monitoring_user_identity . id
8399 ]
84100 }
101+
102+ # keep AKS addon-managed identities and the DNS zone referenced via data sources
103+ key_vault_secrets_provider {
104+ secret_rotation_enabled = false
105+ secret_rotation_interval = " 2m"
106+
107+ # secret_identity is computed by the AKS provider; do not set it here.
108+ }
109+
110+ web_app_routing {
111+ default_nginx_controller = " AnnotationControlled"
112+ dns_zone_ids = [
113+ data . azurerm_dns_zone . capz_monitoring . id ,
114+ ]
115+
116+ # web_app_routing_identity is created/linked by AKS and is computed; do not set it here.
117+ }
118+
85119 default_node_pool {
86120 name = " nodepool1"
87- node_count = 1
121+ node_count = 3
88122 vm_size = " Standard_DS2_v2"
123+
124+ upgrade_settings {
125+ drain_timeout_in_minutes = 0
126+ max_surge = " 10%"
127+ node_soak_duration_in_minutes = 0
128+ }
89129 }
90130
91131 lifecycle {
92132 ignore_changes = [
93- linux_profile ,
133+ linux_profile
94134 ]
95135 }
96136}
0 commit comments