From 098b869103b46f553a3150056d079c3d48fb5caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix-Antoine=20Fortin?= Date: Thu, 12 Nov 2026 11:34:21 -0500 Subject: [PATCH] Simplify gcp zone selection --- CHANGELOG.md | 8 ++++++-- docs/README.md | 3 +-- gcp/infrastructure.tf | 8 ++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16cfc9d2..389cd1a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Changed + +- [GCP] Required Google provider 5.15 or later for machine-type availability lookups. (PR #459) + ### Fixed - [AWS] Persisted the selected availability zone to prevent unintended cluster rebuilds when AWS zone or instance-type offerings change. (PR #458) -- [GCP] Persisted the selected zone to prevent unintended instance and disk rebuilds when the available zone list changes, and rejected unavailable zones instead of silently selecting another zone. -- [GCP] Kept all instances and managed disks in one zone offering every requested instance type, including autoscaling nodes, and validated the stored zone against current offerings. Requires Google provider 5.15 or later. +- [GCP] Persisted the selected zone to prevent unintended instance and disk rebuilds when the available zone list changes, and rejected unavailable zones instead of silently selecting another zone. (PR #459) +- [GCP] Limited automatic zone selection to zones offering all requested instance types, including autoscaling nodes, and validated explicit and stored zones against current offerings. All instances and managed disks remain in one zone. (PR #459) ## [16.1.2] 2026-11-04 diff --git a/docs/README.md b/docs/README.md index 0dc2bcd7..271b1045 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1172,8 +1172,7 @@ assigned number. Defines the name of the specific geographical location where the cluster resources will be hosted. **Requirement**: Must be a Google Cloud region with an available zone offering -all selected instance types. Custom N1 machine types are checked by -family. Refer to [Google Cloud documentation](https://cloud.google.com/compute/docs/regions-zones#available) +all selected instance types. Refer to [Google Cloud documentation](https://cloud.google.com/compute/docs/regions-zones#available) for the list of available regions and their characteristics. #### 5.3.3 zone (optional) diff --git a/gcp/infrastructure.tf b/gcp/infrastructure.tf index 3f99eef5..ce65dc45 100644 --- a/gcp/infrastructure.tf +++ b/gcp/infrastructure.tf @@ -53,24 +53,20 @@ data "google_compute_zones" "available" { locals { instance_types = distinct([for instance in var.instances : instance.type]) - # Custom N1 shapes are not listed by the API; check their machine family. - machine_type_names = { - for type in local.instance_types : type => startswith(type, "custom-") ? "n1-standard-1" : type - } } data "google_compute_machine_types" "available" { for_each = toset(data.google_compute_zones.available.names) project = var.project zone = each.key - filter = join(" OR ", [for type in distinct(values(local.machine_type_names)) : "name = ${jsonencode(type)}"]) + filter = join(" OR ", [for type in local.instance_types : "name = \"${type}\""]) } locals { zone_choices = toset([ for zone, offerings in data.google_compute_machine_types.available : zone if alltrue([ - for type in local.instance_types : contains(offerings.machine_types[*].name, local.machine_type_names[type]) + for type in local.instance_types : contains(offerings.machine_types[*].name, type) ]) ]) }