diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-node-group/README.md b/community/modules/compute/schedmd-slurm-gcp-v5-node-group/README.md index 4a835f2a9..3c69f0f32 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-node-group/README.md +++ b/community/modules/compute/schedmd-slurm-gcp-v5-node-group/README.md @@ -96,13 +96,13 @@ limitations under the License. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.1 | -| [google](#requirement\_google) | >= 3.83 | +| [google](#requirement\_google) | >= 5.11 | ## Providers | Name | Version | |------|---------| -| [google](#provider\_google) | >= 3.83 | +| [google](#provider\_google) | >= 5.11 | ## Modules diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-node-group/versions.tf b/community/modules/compute/schedmd-slurm-gcp-v5-node-group/versions.tf index 0e1d81a91..6f1bd2a65 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-node-group/versions.tf +++ b/community/modules/compute/schedmd-slurm-gcp-v5-node-group/versions.tf @@ -18,7 +18,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 3.83" + version = ">= 5.11" } } provider_meta "google" { diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md b/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md index 9be583a58..5b88c2eda 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md @@ -134,13 +134,13 @@ limitations under the License. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.0 | -| [google](#requirement\_google) | >= 3.83 | +| [google](#requirement\_google) | >= 5.11 | ## Providers | Name | Version | |------|---------| -| [google](#provider\_google) | >= 3.83 | +| [google](#provider\_google) | >= 5.11 | ## Modules @@ -152,6 +152,7 @@ limitations under the License. | Name | Type | |------|------| +| [google_compute_reservation.reservation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_reservation) | data source | | [google_compute_zones.available](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_zones) | data source | ## Inputs diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf index 93a7e803d..baa0e6604 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf @@ -30,6 +30,8 @@ locals { all_zones = toset(concat([var.zone], tolist(var.zones))) excluded_zones = [for z in data.google_compute_zones.available.names : z if !contains(local.all_zones, z)] + + reservation_map = { for x in var.node_groups : x.reservation_name => x } } data "google_compute_zones" "available" { @@ -58,3 +60,29 @@ module "slurm_partition" { partition_startup_scripts = local.ghpc_startup_script partition_startup_scripts_timeout = var.partition_startup_scripts_timeout } + +# tflint-ignore: terraform_unused_declarations +data "google_compute_reservation" "reservation" { + project = var.project_id + zone = var.zone + + for_each = local.reservation_map + name = each.value.reservation_name + + lifecycle { + postcondition { + condition = self.self_link != null + error_message = "couldn't find the reservation ${each.value.reservation_name}}" + } + + postcondition { + condition = coalesce(self.specific_reservation_required, true) + error_message = <