Skip to content

Conversation

@vikramvs-gg
Copy link
Contributor

This change includes addition of validation in variables for naming node-pool and resource-policy resources. This is to validate the namings are as per the GCP naming conventions and avoid validation errors towards the end of resource provisioning.

Without these validations, the user would get the GCP validation error towards the end of cluster deployment when node pool is being spun up. Adding these validations enable checks to kick in at the terraform plan stage itself before applying resources on GCP, thereby pre-validating errors before resources are being provisioned.

Tested the scenarios:

  • Validation in plan stage in case of invalid names.
  • Successful provisioning in case of valid names.

@vikramvs-gg vikramvs-gg requested review from a team and samskillman as code owners October 26, 2025 15:11
@vikramvs-gg vikramvs-gg added the release-module-improvements Added to release notes under the "Module Improvements" heading. label Oct 26, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vikramvs-gg, 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 robustness of Terraform configurations by implementing pre-validation for resource names. Specifically targeting GKE node pools and resource policies, the changes ensure that names comply with GCP's strict naming conventions. This proactive approach shifts potential validation errors from the resource provisioning phase to the earlier Terraform plan stage, significantly improving the developer experience by catching issues before deployment attempts.

Highlights

  • Resource Naming Validation: Introduced validation rules for the name variable in GKE node-pool and resource-policy configurations.
  • GCP Naming Convention Compliance: The added validations ensure that resource names adhere to Google Cloud Platform's specific naming conventions.
  • Early Error Detection: Errors related to invalid resource names will now be caught during the Terraform plan stage, preventing late-stage provisioning failures on GCP.
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.

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 is a good initiative to add input validation for resource names, which helps catch errors early in the terraform plan stage. However, I've found critical issues in both validation blocks. The validations do not account for suffixes that are appended to the names within the modules, which can result in resource names exceeding GCP's maximum length limits and causing deployment failures. This defeats the primary purpose of these changes. My review includes suggestions to correct the length constraints in the regular expressions and to make the error messages more informative. I've also included a minor suggestion to simplify the validation conditions by removing a redundant function call.

@vikramvs-gg vikramvs-gg marked this pull request as draft October 26, 2025 15:19
@vikramvs-gg vikramvs-gg marked this pull request as ready for review October 26, 2025 16:47
@vikramvs-gg vikramvs-gg merged commit 4f4af5c into GoogleCloudPlatform:develop Oct 28, 2025
13 of 67 checks passed
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.

2 participants