feat: add TemplateBuilderCompose SDK types and client method#26350
Merged
Conversation
This was referenced Jun 12, 2026
This was referenced Jun 12, 2026
Contributor
Author
This was referenced Jun 12, 2026
f94ec5a to
fb866aa
Compare
95d959f to
3fda6d7
Compare
fb866aa to
79ca213
Compare
Implement the bases listing endpoint for the template builder. Returns base templates from the bundled catalog with OS metadata resolved from the exampleID->OS map. The endpoint is gated behind the template builder feature flag and returns 404 when disabled.
…talog Reusable Go script that reads the Coder registry repo and generates module.json and .tf.tmpl files for the template builder catalog. Parses variable declarations from main.tf, frontmatter from README.md, and pinned versions from git tags. Usage: go run ./scripts/modulegen/ -registry /path/to/registry -output coderd/templatebuilder/modules Handles escaped quotes and heredoc descriptions, skips variables with heredoc defaults (cannot be represented in the builder UI), uses numeric semver sorting for version tags, and exits non-zero on failures.
…raction Add ModuleRenderContext and RenderModuleTemplate for rendering module .tf.tmpl files with registry URL, pinned version, agent resource name, and variable values. Nil-guards the Variables map to prevent panics. Extract shared renderTemplate with missingkey=error so missing variable keys fail loudly instead of producing "<no value>" in rendered HCL. Add ExtractAgentResourceName which uses a regex to find the coder_agent resource name from rendered base HCL. Strips comment lines (# and //) before matching to avoid false positives. Errors if zero or more than one agent is found. Add ModuleTemplateFS to expose module template files from the embedded catalog, with validation that the expected .tf.tmpl file exists.
Compose renders a base template and selected modules into Terraform source files. It validates modules before rendering: rejects duplicates, ConflictsWith violations, unknown IDs, and OS incompatibility. For each module, mergeModuleVariables fills in manifest defaults for non-computed, non-sensitive variables (with basic JSON type validation), then overlays caller-supplied values. Required variables without defaults are left absent so missingkey=error catches the omission at render time. BundleTar packages the result into a tar archive with reproducible timestamps (time.Unix(0,0)). Writes main.tf always, modules.tf only when modules are present.
Add TemplateBuilderComposeRequest and TemplateBuilderComposeModule request types for the compose endpoint. The response is raw application/x-tar bytes, so TemplateBuilderCompose returns []byte directly (matching the Download pattern in codersdk/files.go). Generated TypeScript types updated.
79ca213 to
1e7157e
Compare
3fda6d7 to
3ea2f09
Compare
zenithwolf1000
approved these changes
Jun 15, 2026
Contributor
Author
Merge activity
|
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.

Note
This PR was authored by Coder Agents on behalf of @jeremyruppel.
Part 3 of DEVEX-277 (POST /api/v2/templatebuilder/compose).
Adds SDK types and client method for the compose endpoint:
TemplateBuilderComposeRequestwithBaseTemplateIDandModules(list of{ID, Variables}). Registry URL is omitted from the request; it comes from server-side deployment config.TemplateBuilderCompose(ctx, req)client method that POSTs the request and returns rawapplication/x-tarbytes (matching theDownloadpattern incodersdk/files.go).