Skip to content

[8.0.0] container: extend google_container_node_pool name_prefix max length to 31 - #18477

Open
c2thorn wants to merge 1 commit into
GoogleCloudPlatform:FEATURE-BRANCH-major-release-8.0.0from
c2thorn:fix-issue-8261-8.0.0
Open

[8.0.0] container: extend google_container_node_pool name_prefix max length to 31#18477
c2thorn wants to merge 1 commit into
GoogleCloudPlatform:FEATURE-BRANCH-major-release-8.0.0from
c2thorn:fix-issue-8261-8.0.0

Conversation

@c2thorn

@c2thorn c2thorn commented Jul 30, 2026

Copy link
Copy Markdown
Member

What changed

  • Updates expandNodePool in resource_container_node_pool.go.tmpl to use tpgresource.ReducedPrefixedUniqueId(p) (appending 9 characters) instead of id.PrefixedUniqueId(p) (appending 26 characters) when len(name_prefix) > 14.
  • Adds a ValidateFunc to "name_prefix" in schemaNodePool capping maximum prefix length at 31 characters (31 + 9 = 40).
  • Adds TestAccContainerNodePool_namePrefix_long to verify that name_prefix values longer than 14 characters provision successfully.
  • Updates container_node_pool.html.markdown resource documentation and the v8.0.0 Upgrade Guide (version_8_upgrade.html.markdown).

Why

Fixes hashicorp/terraform-provider-google#8261. Previously, any name_prefix longer than 14 characters combined with the standard 26-character UUID suffix exceeded GKE's 40-character limit for NodePool.name, failing at apply time with HTTP 400. Following the precedent of compute instance templates (PR #11448), switching to the 9-character shortened suffix for prefixes > 14 extends the maximum allowed name_prefix length from 14 to 31 characters.

Verification

  • Feature Acceptance Test: Executed TestAccContainerNodePool_namePrefix_long (len = 18) against live GKE API; PASSED (HTTP 200 OK, generated name length 27 <= 40).
  • Version Upgrade Safety: Executed TestAccContainerNodePool_namePrefix (len = 6) with RELEASE_DIFF=true; PASSED with 0 plan diffs (No changes), confirming zero drift or recreation when upgrading existing 7.x resources to 8.0.0.
container: extended `name_prefix` max length from 14 to 31 characters for `google_container_node_pool` and `google_container_cluster.node_pool`

…length to 31

Fixes hashicorp/terraform-provider-google#8261 by using ReducedPrefixedUniqueId for name_prefix > 14 characters.
@modular-magician

modular-magician commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 6fb0aff:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 4 files changed, 58 insertions(+), 3 deletions(-)
google-beta provider View Diff 4 files changed, 58 insertions(+), 3 deletions(-)
terraform-google-conversion View Diff 1 file changed, 3 insertions(+)

Test report

Important

Manual Verification Required

VCR cannot automatically execute the following tests added in this PR. Please verify them manually:

🔴 TestAccContainerNodePool_namePrefix_long

Analytics

Total Tests Passed Skipped Affected
321 303 15 3
Affected Service Packages
  • container

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccContainerCluster_regionalWithNodePool
  • TestAccContainerNodePool_withHostMaintenancePolicy
  • TestAccContainerNodePool_withReservationAffinityAnyReservationThenFail

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccContainerNodePool_withReservationAffinityAnyReservationThenFail
❌ Error · Log - TestAccContainerCluster_regionalWithNodePool
❌ Error · Log - TestAccContainerNodePool_withHostMaintenancePolicy

Caution

Issues requiring attention before PR completion

🔴 Manual Verification Required: New tests were added that are skipped in presubmit tests. See the "Manual Verification Required" section at the top for details.

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@c2thorn VCR tests complete for 6fb0aff!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants