Skip to content

Conversation

@DrFaust92
Copy link
Contributor

@DrFaust92 DrFaust92 commented Sep 26, 2025

apologies, missed this again

Fixes: #2437

@DrFaust92 DrFaust92 marked this pull request as ready for review September 26, 2025 02:46
@DrFaust92 DrFaust92 requested review from a team, apeabody and ericyz as code owners September 26, 2025 02:46
@apeabody
Copy link
Collaborator

/gcbrun

@DrFaust92 DrFaust92 marked this pull request as draft September 28, 2025 01:59
@DrFaust92 DrFaust92 marked this pull request as ready for review October 3, 2025 01:07
@apeabody
Copy link
Collaborator

apeabody commented Oct 3, 2025

/gcbrun

1 similar comment
@apeabody
Copy link
Collaborator

apeabody commented Oct 3, 2025

/gcbrun

@apeabody apeabody self-assigned this Oct 3, 2025
@apeabody
Copy link
Collaborator

apeabody commented Oct 3, 2025

/gcbrun

@apeabody
Copy link
Collaborator

apeabody commented Oct 3, 2025

Hi @DrFaust92 - I'm going to run the test again, but this is the only PR I'm currently seeing this error:

Error: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.

  with module.example.module.gke.google_container_cluster.primary,
  on ../../../modules/beta-public-cluster/cluster.tf line 22, in resource "google_container_cluster" "primary":
  22: resource "google_container_cluster" "primary" {
}

@apeabody
Copy link
Collaborator

apeabody commented Oct 3, 2025

/gcbrun

@apeabody
Copy link
Collaborator

apeabody commented Oct 7, 2025

Thanks @DrFaust92, still seeing:

TestNodePool 2025-10-07T21:08:49Z command.go:212: module.example.module.gke.google_container_cluster.primary: Creating...
TestNodePool 2025-10-07T21:08:49Z command.go:212: 
TestNodePool 2025-10-07T21:08:49Z command.go:212: Error: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
TestNodePool 2025-10-07T21:08:49Z command.go:212: 
TestNodePool 2025-10-07T21:08:49Z command.go:212:   with module.example.module.gke.google_container_cluster.primary,
TestNodePool 2025-10-07T21:08:49Z command.go:212:   on ../../../modules/beta-public-cluster/cluster.tf line 22, in resource "google_container_cluster" "primary":
TestNodePool 2025-10-07T21:08:49Z command.go:212:   22: resource "google_container_cluster" "primary" {
TestNodePool 2025-10-07T21:08:49Z command.go:212: 

@cwh-hcl
Copy link

cwh-hcl commented Oct 8, 2025

I don't think the additional_ip_ranges_config variable needs to be defined as a list... see my comment here -> #2437 (comment)

@DrFaust92 DrFaust92 marked this pull request as draft October 8, 2025 17:54
@DrFaust92 DrFaust92 marked this pull request as ready for review October 8, 2025 18:10
@apeabody
Copy link
Collaborator

apeabody commented Oct 8, 2025

/gcbrun

1 similar comment
@apeabody
Copy link
Collaborator

apeabody commented Oct 8, 2025

/gcbrun

@apeabody
Copy link
Collaborator

apeabody commented Oct 9, 2025

/gcbrun

@DrFaust92
Copy link
Contributor Author

apeabody, can you share the current failure? 🙏

@apeabody
Copy link
Collaborator

apeabody commented Oct 9, 2025

apeabody, can you share the current failure? 🙏

Hi @DrFaust92 - Running again as I'm not convinced this is due to the change:

Step #60 - "apply node-pool-local": Error: Error updating cluster for []: googleapi: Error 400: Cluster is running incompatible operation operation-1760041804071-8378a7c3-539b-4e68-a2d3-8f58bb864553.
Step #60 - "apply node-pool-local": Details:
Step #60 - "apply node-pool-local": [
Step #60 - "apply node-pool-local":   {
Step #60 - "apply node-pool-local":     "@type": "type.googleapis.com/google.rpc.RequestInfo",
Step #60 - "apply node-pool-local":     "requestId": "0xf2eadd1a8ccb3137"
Step #60 - "apply node-pool-local":   },
Step #60 - "apply node-pool-local":   {
Step #60 - "apply node-pool-local":     "@type": "type.googleapis.com/google.rpc.ErrorInfo",
Step #60 - "apply node-pool-local":     "domain": "container.googleapis.com",
Step #60 - "apply node-pool-local":     "reason": "CLUSTER_ALREADY_HAS_OPERATION"
Step #60 - "apply node-pool-local":   }
Step #60 - "apply node-pool-local": ]
Step #60 - "apply node-pool-local": , failedPrecondition
Step #60 - "apply node-pool-local": 
Step #60 - "apply node-pool-local":   with module.example.module.gke.google_container_cluster.primary,
Step #60 - "apply node-pool-local":   on ../../../modules/beta-public-cluster/cluster.tf line 22, in resource "google_container_cluster" "primary":
Step #60 - "apply node-pool-local":   22: resource "google_container_cluster" "primary" {
Step #60 - "apply node-pool-local": }

@apeabody
Copy link
Collaborator

apeabody commented Oct 10, 2025

apeabody, can you share the current failure? 🙏

Hi @DrFaust92 - Running again as I'm not convinced this is due to the change:

Step #60 - "apply node-pool-local": Error: Error updating cluster for []: googleapi: Error 400: Cluster is running incompatible operation operation-1760041804071-8378a7c3-539b-4e68-a2d3-8f58bb864553.
Step #60 - "apply node-pool-local": Details:
Step #60 - "apply node-pool-local": [
Step #60 - "apply node-pool-local":   {
Step #60 - "apply node-pool-local":     "@type": "type.googleapis.com/google.rpc.RequestInfo",
Step #60 - "apply node-pool-local":     "requestId": "0xf2eadd1a8ccb3137"
Step #60 - "apply node-pool-local":   },
Step #60 - "apply node-pool-local":   {
Step #60 - "apply node-pool-local":     "@type": "type.googleapis.com/google.rpc.ErrorInfo",
Step #60 - "apply node-pool-local":     "domain": "container.googleapis.com",
Step #60 - "apply node-pool-local":     "reason": "CLUSTER_ALREADY_HAS_OPERATION"
Step #60 - "apply node-pool-local":   }
Step #60 - "apply node-pool-local": ]
Step #60 - "apply node-pool-local": , failedPrecondition
Step #60 - "apply node-pool-local": 
Step #60 - "apply node-pool-local":   with module.example.module.gke.google_container_cluster.primary,
Step #60 - "apply node-pool-local":   on ../../../modules/beta-public-cluster/cluster.tf line 22, in resource "google_container_cluster" "primary":
Step #60 - "apply node-pool-local":   22: resource "google_container_cluster" "primary" {
Step #60 - "apply node-pool-local": }

I'm seeing the same error in #2466

@DrFaust92 DrFaust92 marked this pull request as draft October 26, 2025 19:15
Signed-off-by: drfaust92 <[email protected]>
Signed-off-by: drfaust92 <[email protected]>
@DrFaust92
Copy link
Contributor Author

on the side new smaller test works well, there is some race condition between changes that happen during create. with the "node_pool" config. so i copied the "simple_regional" one and added the additional_ip_ranges config for a dedicate test

Signed-off-by: drfaust92 <[email protected]>
@DrFaust92 DrFaust92 marked this pull request as ready for review October 26, 2025 19:57
@DrFaust92
Copy link
Contributor Author

@apeabody if you can kickstart tests, local apply is passing

@apeabody
Copy link
Collaborator

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes an issue with iterating over additional_ip_ranges_config in dynamic blocks across multiple module variants. The change to use additional_ip_ranges_config.value is the correct approach for accessing elements within a for_each loop. The addition of a new example and integration tests for this feature is a good improvement. However, I've identified an issue in the new integration test that will cause it to fail.

clusterName := bpt.GetStringOutput("cluster_name")
serviceAccount := bpt.GetStringOutput("service_account")

op := gcloud.Runf(t, "container clusters describe %s --zone %s --project %s", clusterName, location, projectId)

Choose a reason for hiding this comment

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

high

The gcloud container clusters describe command is using the --zone flag for a regional cluster. Since this test is for a regional cluster, the --region flag should be used instead. The location output for a regional cluster is the region, so using it with --zone will cause an error.

Suggested change
op := gcloud.Runf(t, "container clusters describe %s --zone %s --project %s", clusterName, location, projectId)
op := gcloud.Runf(t, "container clusters describe %s --region %s --project %s", clusterName, location, projectId)

@apeabody
Copy link
Collaborator

/gcbrun

@apeabody
Copy link
Collaborator

/gcbrun

@apeabody
Copy link
Collaborator

Thanks @DrFaust92!

This looks great, we just need to add the new integration test to the build: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/main/build/int.cloudbuild.yaml#L514

Something like this:

- id: apply test-simple-regional
  waitFor:
    - init-all
  name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
  args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage apply --verbose']
- id: verify test-simple-regional
  waitFor:
    - apply test-simple-regional
  name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
  args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage verify --verbose']
- id: teardown test-simple-regional
  waitFor:
    - verify test-simple-regional
  name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
  args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage teardown --verbose']

Signed-off-by: drfaust92 <[email protected]>
@DrFaust92
Copy link
Contributor Author

Thanks @DrFaust92!

This looks great, we just need to add the new integration test to the build: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/main/build/int.cloudbuild.yaml#L514

Something like this:

- id: apply test-simple-regional
  waitFor:
    - init-all
  name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
  args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage apply --verbose']
- id: verify test-simple-regional
  waitFor:
    - apply test-simple-regional
  name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
  args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage verify --verbose']
- id: teardown test-simple-regional
  waitFor:
    - verify test-simple-regional
  name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
  args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage teardown --verbose']

added

@apeabody
Copy link
Collaborator

/gcbrun

1 similar comment
@apeabody
Copy link
Collaborator

/gcbrun

@apeabody
Copy link
Collaborator

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to specify pod_ipv4_range_names?

4 participants