Skip to content

Replaced BasePath usage in universe tests, acm, ad, alloydb, and apigee#27207

Merged
modular-magician merged 1 commit intohashicorp:mainfrom
modular-magician:downstream-pr-3e261ae3d5b07039626fe38af5a7b0dc068a255d
May 1, 2026
Merged

Replaced BasePath usage in universe tests, acm, ad, alloydb, and apigee#27207
modular-magician merged 1 commit intohashicorp:mainfrom
modular-magician:downstream-pr-3e261ae3d5b07039626fe38af5a7b0dc068a255d

Conversation

@modular-magician
Copy link
Copy Markdown
Collaborator

This is an initial set of replacements of BasePath usage in handwritten files with the transport_tpg.BaseUrl function.

Note: String concatenation is used instead of URL joining because URL joining would escape {} characters, preventing ReplaceVars from working properly.

Options considered:

  • This PR
    • Pros: compile time verification; explicit about how the base URL is calculated.
    • Cons: requires rewriting large number of handwritten files; some code duplication in that config has to be passed twice.
  • Pass product to ReplaceVars and implicitly add the base URL to the beginning of the URL
    • Pros: compile time verification; doesn't require passing config twice.
    • Cons: Breaks separation of concerns; ReplaceVars would no longer just be replacing vars. There's probably some usage somewhere outside of URL building that would need to be split out. More implicit behavior.
  • Automatically make ReplaceVars detect {{ProductNameBasePath}} variables, trim the BasePath suffix, look up the relevant product in the registry (with the lowercase productname), and compute its BaseUrl using the config that was also passed in.
    • Pros: ReplaceVars usage could remain unchanged - many fewer files would need to be modified. (There are about 960 uses of BasePaths in services, most of which are via ReplaceVars.)
    • Cons: ReplaceVars can't have compile time checks (this is also a problem today) and base URL calculation is implicit.
    • EDIT: Planning to do this as a compatibility shim to ease the migration off config.*BasePath fields: Handle *BasePath replacement with BaseUrl func GoogleCloudPlatform/magic-modules#17385

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.


Derived from GoogleCloudPlatform/magic-modules#17370

…ee (hashicorp#17370)

[upstream:3e261ae3d5b07039626fe38af5a7b0dc068a255d]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit d0eaf5d into hashicorp:main May 1, 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.

1 participant