I am trying to update/change value of pod_subnet_id of my aks cluster using terraform from "abc" to "xyz". It gives me error message which makes sense, so i have included a condition in my TF code as below :
pod_subnet_id = var.pod_subnet
temporary_name_for_rotation = var.pod_subnet_id != null ? "tmpnodepool01" : null
But problem with above code is everytime when pod_subnet_id will have value it will create "tmpnodepool01" but I want to only create it when pod_subnet_id value gets updated.
temporary_name_for_rotation must be specified when changing any of the following properties: enable_host_encryption, enable_node_public_ip, kubelet_config, linux_os_config, max_pods, node_taints, only_critical_addons_enabled, os_disk_size_gb, os_disk_type, os_sku, pod_subnet_id, snapshot_id, ultra_ssd_enabled, vnet_subnet_id, vm_size, zones
Providing temporary_name_for_rotation = "tmpnodepool1"
should be enough.
As the name implies, it's just a temp value used to cycle the system node pool of the cluster. So that value will only be used if any of the mentioned properties changes. Therefore, the logic you are looking for is there by default.