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 apeabody, ericyz and a team as code owners September 26, 2025 02:46
@apeabody
Copy link
Collaborator

/gcbrun

Comment on lines 547 to 548
subnetwork = var.additional_ip_ranges_config.value.subnetwork
pod_ipv4_range_names = var.additional_ip_ranges_config.value.pod_ipv4_range_names
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be like this instead?

Suggested change
subnetwork = var.additional_ip_ranges_config.value.subnetwork
pod_ipv4_range_names = var.additional_ip_ranges_config.value.pod_ipv4_range_names
subnetwork = additional_ip_ranges_config.value.subnetwork
pod_ipv4_range_names = additional_ip_ranges_config.value.pod_ipv4_range_names

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@DrFaust92 - Can you please add a usage to the existing node_pool example and test data so we have sufficient test coverage. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I think i added the changes and test. can we trigger a run?

@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

Signed-off-by: drfaust92 <[email protected]>
Signed-off-by: drfaust92 <[email protected]>
Signed-off-by: drfaust92 <[email protected]>
Signed-off-by: drfaust92 <[email protected]>
@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
Signed-off-by: drfaust92 <[email protected]>
additional_ip_ranges_config = [
{
subnetwork = var.subnetwork
subnetwork = "projects/${var.project_id}/regions/${var.region}/subnetworks/${var.subnetwork}"
Copy link
Contributor Author

@DrFaust92 DrFaust92 Oct 8, 2025

Choose a reason for hiding this comment

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

@apeabody I think this was the issue, plan passes either way. but error is strange

Copy link

Choose a reason for hiding this comment

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

additional_ip_ranges_config is not a list/array as defined in the google_container_cluster documentation. See https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#additional_ip_ranges_config-1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Well that's interesting. So as a data point, I was able to update the module locally so that it was an 'object' and NOT a 'list' and it then the terraform plan handled this section for me correctly. As a list it complained, as detailed in the comment I referenced above.

I'm not sure why the discrepancy..?

Copy link

Choose a reason for hiding this comment

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

It looks like in the Google console UI it is a List so I can try again and see what comes out of the changes here

Copy link

Choose a reason for hiding this comment

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

@DrFaust92 sorry for the spam, just want to let you know you are right and the changes you have here I tested locally in my environment and fix my issue, so for what it's worth LGTM! Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @DrFaust92 - Looks like we are close

Error: Error updating cluster for []: googleapi: Error 400: The cluster's default subnetwork cannot be used as an additional subnetwork.

If needed, this is where the current one is defined: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/main/test/fixtures/node_pool/network.tf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lets try once more @apeabody , thanks for bearing with me on this

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @DrFaust92!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @DrFaust92 - Looks like the docs need to be regenerated after the change. Thanks!

Checking submodule's files generation
diff -r '--exclude=.terraform' '--exclude=.kitchen' '--exclude=.git' /workspace/examples/node_pool/README.md /tmp/tmp.VdIZFvHmj1/workspace/examples/node_pool/README.md
10a11
> | additional\_ip\_pod\_range\_subnetwork | The subnetwork to host the additional pod range in | `any` | n/a | yes |
Error: submodule's files generation has not been run, please run the
'make build' command and commit changes
Checking for documentation generation
diff -r '--exclude=.terraform' '--exclude=.kitchen' '--exclude=autogen' '--exclude=*.tfvars' '--exclude=*metadata.yaml' /workspace/examples/node_pool/README.md /tmp/tmp.QlBKcRfkkq/generate_docs/workspace/examples/node_pool/README.md
10a11
> | additional\_ip\_pod\_range\_subnetwork | The subnetwork to host the additional pod range in | `any` | n/a | yes |
Error: Documentation generation has not been run, please run the
'make docker_generate_docs' command and commit the above changes.

@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

Signed-off-by: drfaust92 <[email protected]>
@apeabody
Copy link
Collaborator

apeabody commented Oct 8, 2025

/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