fix(UP-0): dspm instance template name collision - #64
Merged
Conversation
steveh2707
force-pushed
the
fix/dspm-instance-template-name-collision
branch
from
August 27, 2026 11:14
6d0764d to
748b46d
Compare
dgilmore42
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GCP Argo workflows transiently fail with:
Root cause
The google provider picks one of two name generators based on
name_prefixlength:"upwind-tpl-dspm-"(16) +scanner_id(always 21:ucsc-+ 2x8 hex) +-(1) = 38 — one character over the threshold. So DSPM template names carried no time component and no randomness, only the UTC date and a counter that resets to 0 in every terraform process.…-260827002decomposes as260827(2026-08-27) +002.Both DSPM templates are
create_before_destroy, andsource_image = var.boot_imagemakes any boot image bump a ForceNew replacement. A replacement therefore has to mint a new name while the old template still exists — and if that old template was created on the same UTC day (boot image rollout followed by a re-apply, a reinstall, or a workflow re-submission after a partial failure), the "new" name is the old one. Within a single apply at most four templates draw from the counter, so the suffix is effectively one of001–004; whether a given run collides depends on the order the parallel creations grab values, which is why it fails intermittently rather than every time.The regular
cloudscanner_inst_templateswere never affected — their prefix is 33 characters, so they stay on the full-timestamp path.Fix
Shorten the DSPM marker to
ds-, putting the prefix at 36 characters and restoring the full 26-character unique suffix (62-character names, one under GCE's 63 limit).The names must keep the
upwind-tpl-prefix: the scaler's instance template IAM binding is conditioned on it (terraform-gcp-onboarding/modules/_shared/iam/roles.tf,resource.name.extract('instanceTemplates/{template}').startsWith('upwind-tpl-')). With 11 characters spent there and 21 onscanner_id, that leaves 5 for the marker and separator.Both prefixes now come from locals with a
preconditionon the 37-character limit, so this can't be crossed again unnoticed — nothing catches it today, sincescanner_idis only validated as^ucsc-[a-zA-Z0-9]{1,}$.Rollout notes
name_prefixis ForceNew, so the next apply replaces both DSPM templates. This migration is safe: the new names come from a different prefix, so create-before-destroy cannot collide.upwind-tpl-dspm-…template, or re-run after 00:00 UTC.Testing
terraform fmt -check -recursive— cleanterraform validateonmodules/main— passestflintnot installed locally; left to CI🤖 Generated with Claude Code