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
This commit is contained in:
Dalton Hubble
2019-05-27 22:55:16 -07:00
parent 189487ecaa
commit 28506df9c7
2 changed files with 5 additions and 1 deletions

View File

@ -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.