Skip to content

Commit 7130e83

Browse files
authored
fix: IaC Azure requires 'temporary_name_for_rotation' during update (#502)
Signed-off-by: David.Houck <[email protected]>
1 parent 50bb0c1 commit 7130e83

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

modules/aks_node_pool/main.tf

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ resource "azurerm_kubernetes_cluster_node_pool" "autoscale_node_pool" {
2828
priority = var.community_priority
2929
eviction_policy = var.community_eviction_policy
3030
spot_max_price = var.community_spot_max_price
31+
temporary_name_for_rotation = substr("t${var.node_pool_name}", 0, 12)
3132

3233
lifecycle {
3334
ignore_changes = [node_count]
3435
}
3536

36-
linux_os_config {
37-
sysctl_config {
38-
vm_max_map_count = try(var.linux_os_config.sysctl_config.vm_max_map_count,null)
37+
dynamic "linux_os_config" {
38+
for_each = var.linux_os_config[*]
39+
content {
40+
sysctl_config {
41+
vm_max_map_count = var.linux_os_config.sysctl_config.vm_max_map_count
42+
}
3943
}
4044
}
4145
}
@@ -64,9 +68,14 @@ resource "azurerm_kubernetes_cluster_node_pool" "static_node_pool" {
6468
priority = var.community_priority
6569
eviction_policy = var.community_eviction_policy
6670
spot_max_price = var.community_spot_max_price
67-
linux_os_config {
68-
sysctl_config {
69-
vm_max_map_count = try(var.linux_os_config.sysctl_config.vm_max_map_count,null)
71+
temporary_name_for_rotation = substr("t${var.node_pool_name}", 0, 12)
72+
73+
dynamic "linux_os_config" {
74+
for_each = var.linux_os_config[*]
75+
content {
76+
sysctl_config {
77+
vm_max_map_count = var.linux_os_config.sysctl_config.vm_max_map_count
78+
}
7079
}
7180
}
7281
}

modules/azurerm_vm/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,9 @@ resource "azurerm_linux_virtual_machine" "vm" {
107107

108108
tags = var.tags
109109

110+
lifecycle {
111+
ignore_changes = [ identity ]
112+
}
113+
110114
depends_on = [azurerm_network_interface_security_group_association.vm_nic_sg]
111115
}

0 commit comments

Comments
 (0)