Hi there,
We have created a managed instance group using the below configuration
resource "google_compute_region_instance_group_manager" "gui" {
name = join("-", [var.cluster_name, "guinode-mig"])
base_instance_name = join("-", [var.cluster_name, "guinode"])
region = var.region
distribution_policy_zones = [var.zone]
version {
instance_template = google_compute_instance_template.gui.self_link
}
target_size = 1
named_port {
name = "httpsport"
port = 8443
}
}
It can be seen that the version block doesn’t have any value for the name setting. But after a few terraform apply operations, the plan started to show that the google_compute_region_instance_group_manager resource is going to be updated because of the changing value of the name. The output is shown below:
# module.redacted.google_compute_region_instance_group_manager.gui will be updated in-place
~ resource "google_compute_region_instance_group_manager" "gui" {
base_instance_name = "redacted"
distribution_policy_zones = [
"us-west2-c",
]
fingerprint = "redacted"
id = "redacted"
instance_group = "redacted"
name = "redacted"
project = "redacted"
region = "redacted"
self_link = "redacted"
target_pools = []
target_size = 1
wait_for_instances = false
named_port {
name = "redacted"
port = redacted
}
update_policy {
instance_redistribution_type = "PROACTIVE"
max_surge_fixed = 1
max_surge_percent = 0
max_unavailable_fixed = 1
max_unavailable_percent = 0
min_ready_sec = 0
minimal_action = "RESTART"
type = "PROACTIVE"
}
~ version {
instance_template = "redacted"
- name = "0-1624390439185" -> null
}
}
Since the file that contains the configuration for google_compute_region_instance_group_manager resource has not been changed, I have difficulty understanding why this kind of update is triggered. Would there be any explanation so that I can avoid these kinds of changes? By the way, I assume that I can avoid this by setting the name explicitly but knowing the exact reason would be nice.
Thanks in advance,
Ender