Skip to content

fix(htcondor): explicitly set region for cm and ap addresses to match subnetwork region#3991

Merged
tpdownes merged 1 commit into
GoogleCloudPlatform:developfrom
rbekhtaoui:specify-address-region-gce-cm-ap
Apr 24, 2025
Merged

fix(htcondor): explicitly set region for cm and ap addresses to match subnetwork region#3991
tpdownes merged 1 commit into
GoogleCloudPlatform:developfrom
rbekhtaoui:specify-address-region-gce-cm-ap

Conversation

@rbekhtaoui

Copy link
Copy Markdown
Contributor

This PR fixes an issue in the scheduler htcondor module where google_compute_address resources for both the Access Point (ap) and Central Manager (cm) were created without an explicitly defined region.

Problem :
When deploying in a multi-region setup, the google_compute_address resources default to the region specified in the provider block. However, the associated subnetwork may belong to a different region. This led to the following deployment error :

│ Error: Error creating Address: googleapi: Error 400: Invalid value for field 'resource.subnetwork': 'projects//regions/europe-west4/subnetworks/htcondor-subnet'. Subnetwork must be in the same region., invalid
│ 
│   with module.htcondor_access.google_compute_address.ap,
│   on modules/embedded/community/modules/scheduler/htcondor-access-point/main.tf line 234, in resource "google_compute_address" "ap":
│  234: resource "google_compute_address" "ap" {
│ 
╵
╷
│ Error: Error creating Address: googleapi: Error 400: Invalid value for field 'resource.subnetwork': 'projects//regions/europe-west4/subnetworks/htcondor-subnet'. Subnetwork must be in the same region., invalid
│ 
│   with module.htcondor_cm.google_compute_address.cm,
│   on modules/embedded/community/modules/scheduler/htcondor-central-manager/main.tf line 141, in resource "google_compute_address" "cm":
│  141: resource "google_compute_address" "cm" {

Fix
The fix explicitly sets the region attribute for both ap and cm address resources to use var.region, ensuring that they are provisioned in the same region as the subnetwork (var.subnetwork_self_link).

Changes
Added region = var.region to the google_compute_address "ap" resource in the Access Point module

Added region = var.region to the google_compute_address "cm" resource in the Central Manager module

This ensures compatibility and correctness in multi-region deployments.

@tpdownes

Copy link
Copy Markdown
Contributor

/gcbrun

@tpdownes tpdownes added the release-module-improvements Added to release notes under the "Module Improvements" heading. label Apr 24, 2025
@tpdownes tpdownes self-assigned this Apr 24, 2025

@tpdownes tpdownes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tpdownes tpdownes enabled auto-merge April 24, 2025 14:59
@tpdownes tpdownes merged commit 8f2ba24 into GoogleCloudPlatform:develop Apr 24, 2025
@rbekhtaoui rbekhtaoui deleted the specify-address-region-gce-cm-ap branch June 18, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-module-improvements Added to release notes under the "Module Improvements" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants