Fix Fedora CoreOS on GCP proposing controller recreate

* With Fedora CoreOS image stream support (#727), the latest
resolved image will change over the lifecycle of a cluster.
* Fix issue where an image diff proposed replacing a Fedora
CoreOS controller on GCP, introduced in #727 (unreleased)
* Also ignore image diffs to the GCP managed instance group
of workers. This aligns with worker AMI diffs being ignored
on AWS and similar on Azure, since workers update themselves.

Background:

* Controller nodes should strictly not be recreated by Terraform,
they are stateful (etcd) and should not be replaced
* Across cloud platforms, OS image diffs are ignored since both
Flatcar Linux and Fedora CoreOS nodes update themselves. For
workers, user-data or disk size diffs (where relevant) are allowed
to recreate workers templates/configs since these are considered
to be user-initiated declarations that a reprovision should be done
This commit is contained in:
Dalton Hubble 2020-05-19 21:41:51 -07:00
parent 8d024d22ad
commit 09eb208b4e
2 changed files with 7 additions and 1 deletions

View File

@ -59,7 +59,10 @@ resource "google_compute_instance" "controllers" {
tags = ["${var.cluster_name}-controller"]
lifecycle {
ignore_changes = [metadata]
ignore_changes = [
metadata,
boot_disk[0].initialize_params
]
}
}

View File

@ -64,6 +64,9 @@ resource "google_compute_instance_template" "worker" {
}
lifecycle {
ignore_changes = [
disk[0].source_image
]
# To update an Instance Template, Terraform should replace the existing resource
create_before_destroy = true
}