Skip to content

feat: Add private endpoint subnetwork variable for safer cluster modules#2540

Merged
apeabody merged 4 commits intoterraform-google-modules:mainfrom
christiangonre:master
Feb 24, 2026
Merged

feat: Add private endpoint subnetwork variable for safer cluster modules#2540
apeabody merged 4 commits intoterraform-google-modules:mainfrom
christiangonre:master

Conversation

@christiangonre
Copy link
Contributor

This PR adds the option to define a private_endpoint_subnetwork value for the safer-cluster modules.

After this PR, every time you want to create a new GKE cluster it creates a new subnet in the same VPC of the GKE cluster. This PR adds the option to deploy the endpoint without creating a new subnet.

No breaking changes because the default value of the var is null, same value that we are using currently in the private_cluster module

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @christiangonre, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the GKE safer-cluster modules by adding a new configuration option that allows users to explicitly define a subnetwork for the private endpoint. This provides more flexibility in network design and resource management, as it avoids the automatic creation of a new subnet and instead enables the use of an existing one. The change is designed to be backward-compatible, maintaining stability for current implementations.

Highlights

  • New Variable for Private Endpoints: Introduced a new variable, private_endpoint_subnetwork, to the safer-cluster modules, allowing users to specify an existing subnetwork for the GKE private endpoint.
  • Enhanced Network Control: This change provides greater control over network resource provisioning by enabling the use of a pre-existing subnetwork, preventing the automatic creation of a new one for the private endpoint.
  • Non-Breaking Change: The new variable defaults to null, ensuring no breaking changes for existing deployments.
Changelog
  • autogen/safer-cluster/main.tf.tmpl
    • Added the private_endpoint_subnetwork variable to the module "gke" configuration.
  • autogen/safer-cluster/variables.tf.tmpl
    • Defined a new private_endpoint_subnetwork variable of type string with a default value of null.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@google-cla
Copy link

google-cla bot commented Feb 11, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@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 introduces a private_endpoint_subnetwork variable to the safer-cluster module, allowing users to specify an existing subnetwork for the GKE cluster's private endpoint. This is a valuable addition for more flexible network configurations. I've found one potential issue where using the new variable could cause Terraform errors due to conflicting arguments. My review includes a comment with a suggested fix for this.

@apeabody
Copy link
Collaborator

/gemini review

@apeabody
Copy link
Collaborator

/gcbrun

Copy link
Contributor

@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 introduces the private_endpoint_subnetwork variable to the safer-cluster modules, allowing users to specify an existing subnetwork for the GKE master's private endpoint. This is a valuable addition that avoids the automatic creation of a new subnet. The implementation is sound and consistently applied across the autogen templates and the generated modules. I've suggested some minor documentation improvements to clarify the relationship between the new variable and master_ipv4_cidr_block for better user experience.

@apeabody
Copy link
Collaborator

/gcbrun

@apeabody
Copy link
Collaborator

/gemini review

Copy link
Contributor

@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 adds the private_endpoint_subnetwork variable to the safer-cluster and safer-cluster-update-variant modules, allowing users to specify an existing subnetwork for the GKE private endpoint. The implementation correctly nullifies master_ipv4_cidr_block when private_endpoint_subnetwork is used, respecting their mutual exclusivity. All relevant files, including autogen templates, module code, documentation, and metadata, have been updated consistently. The change is non-breaking as the new variable defaults to null.

@apeabody
Copy link
Collaborator

/gcbrun

Copy link
Collaborator

@apeabody apeabody left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @christiangonre

@apeabody apeabody merged commit ca18dbc into terraform-google-modules:main Feb 24, 2026
4 checks passed
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.

2 participants