From 28506df9c7e0ee3b8dcba8fc5e15524b80cefe69 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Mon, 27 May 2019 22:55:16 -0700 Subject: [PATCH] Avoid unneeded rotations of Regular priority virtual machine scale sets * Azure only allows `eviction_policy` to be set for Low priority VMs. Supporting Low priority VMs meant when Regular VMs were used, each `terraform apply` rolled workers, to set eviction_policy to null. * Terraform v0.12 nullable variables fix the issue and plan does not produce a diff --- CHANGES.md | 3 +++ azure/container-linux/kubernetes/workers/workers.tf | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 24ae8114..8f4e3262 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,9 @@ Notable changes between versions. * Migrate from Terraform v0.11 to v0.12.x (**action required!**) * Require `terraform-provider-azurerm` v1.27+ to support Terraform v0.12 * Require `terraform-provider-ct` v0.3.2+ to support Terraform v0.12 +* Avoid unneeded rotations of Regular priority virtual machine scale sets + * Azure only allows `eviction_policy` to be set for Low priority VMs. Supporting Low priority VMs meant when Regular VMs were used, each `terraform apply` rolled workers, to set eviction_policy to null. + * Terraform v0.12 nullable variables fix the issue and plan does not produce a diff. #### DigitalOcean diff --git a/azure/container-linux/kubernetes/workers/workers.tf b/azure/container-linux/kubernetes/workers/workers.tf index 01e35f7f..9e32c4b6 100644 --- a/azure/container-linux/kubernetes/workers/workers.tf +++ b/azure/container-linux/kubernetes/workers/workers.tf @@ -68,8 +68,9 @@ resource "azurerm_virtual_machine_scale_set" "workers" { # lifecycle upgrade_policy_mode = "Manual" + # eviction policy may only be set when priority is Low priority = var.priority - eviction_policy = "Delete" + eviction_policy = var.priority == "Low" ? "Delete" : null } # Scale up or down to maintain desired number, tolerating deallocations.