Skip to content

Improve pre existing vpc failure mechanism#1897

Merged
alyssa-sm merged 1 commit into
GoogleCloudPlatform:developfrom
alyssa-sm:improve-pre-existing-vpc-failure-mechanism
Nov 7, 2023
Merged

Improve pre existing vpc failure mechanism#1897
alyssa-sm merged 1 commit into
GoogleCloudPlatform:developfrom
alyssa-sm:improve-pre-existing-vpc-failure-mechanism

Conversation

@alyssa-sm

@alyssa-sm alyssa-sm commented Oct 27, 2023

Copy link
Copy Markdown
Contributor

Changes pre-existing-vpc to check whether a network can be found using post-conditions.

Prior to this PR, failure to find a valid network/subnetwork would present an error like this:

Error: terraform plan for deployment group small-hpc/primary failed; suggest running "ghpc export-outputs" on previous deployment groups to define inputs
exit status 1

Error: must provide either `self_link` or `name`

  with module.debug_partition.module.slurm_partition.data.google_compute_subnetwork.partition_subnetwork,
  on .terraform/modules/debug_partition.slurm_partition/terraform/slurm_cluster/modules/slurm_partition/main.tf line 100, in data "google_compute_subnetwork" "partition_subnetwork":
 100: data "google_compute_subnetwork" "partition_subnetwork" {


Error: Invalid function argument

  on .terraform/modules/slurm_login.slurm_login_instance/terraform/slurm_cluster/modules/slurm_login_instance/main.tf line 23, in locals:
  23:     length(regexall("/regions/([^/]*)", var.subnetwork)) > 0
    ├────────────────
    │ while calling regexall(pattern, string)
    │ var.subnetwork is null

Invalid value for "string" parameter: argument must not be null.

With the addition of the post-conditions, the error message looks like this when the network/subnetwork cannot be found.

Error: terraform plan for deployment group small-hpc/primary failed; suggest running "ghpc export-outputs" on previous deployment groups to define inputs
exit status 1

Error: Resource postcondition failed

  on modules/embedded/modules/network/pre-existing-vpc/main.tf line 24, in data "google_compute_network" "vpc":
  24:       condition     = self.self_link != null
    ├────────────────
    │ self.self_link is null

The network, bad-network, with the project ID dev-pool-prj3 could not be found.

Error: Resource postcondition failed

  on modules/embedded/modules/network/pre-existing-vpc/main.tf line 41, in data "google_compute_subnetwork" "primary_subnetwork":
  41:       condition     = self.self_link != null 
    ├────────────────
    │ self.self_link is null

The subnetwork, bad-subnetwork, could not be found.

TESTED:

The following cases were tested.
- Blueprints with valid networks and subnetworks
- Blueprints with valid a network and an invalid subnetwork
- Blueprints with an invalid network and invalid subnetwork

@alyssa-sm alyssa-sm added the release-chore To not include into release notes label Oct 27, 2023
@alyssa-sm alyssa-sm requested a review from nick-stroud October 27, 2023 23:33
@alyssa-sm alyssa-sm self-assigned this Oct 27, 2023
@alyssa-sm alyssa-sm changed the base branch from main to develop October 27, 2023 23:33
@alyssa-sm alyssa-sm assigned nick-stroud and unassigned alyssa-sm Nov 1, 2023
Comment thread modules/network/pre-existing-vpc/main.tf
Comment thread modules/network/pre-existing-vpc/main.tf Outdated
Comment thread modules/network/pre-existing-vpc/main.tf Outdated
Comment thread modules/network/pre-existing-vpc/main.tf Outdated
@nick-stroud nick-stroud assigned alyssa-sm and unassigned nick-stroud Nov 1, 2023
@alyssa-sm alyssa-sm force-pushed the improve-pre-existing-vpc-failure-mechanism branch 3 times, most recently from c2081e2 to 79b6d25 Compare November 3, 2023 21:43
@alyssa-sm alyssa-sm assigned nick-stroud and unassigned alyssa-sm Nov 6, 2023
@nick-stroud nick-stroud assigned alyssa-sm and unassigned nick-stroud Nov 6, 2023
@alyssa-sm alyssa-sm force-pushed the improve-pre-existing-vpc-failure-mechanism branch from 79b6d25 to cc37e06 Compare November 6, 2023 22:04
@alyssa-sm alyssa-sm force-pushed the improve-pre-existing-vpc-failure-mechanism branch from cc37e06 to 4e4c3a4 Compare November 6, 2023 22:06
@alyssa-sm alyssa-sm merged commit f16d4bd into GoogleCloudPlatform:develop Nov 7, 2023
@alyssa-sm alyssa-sm deleted the improve-pre-existing-vpc-failure-mechanism branch November 7, 2023 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-chore To not include into release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants