feat(coderd/templatebuilder): add Compose and BundleTar functions - #26349
Merged
Conversation
jeremyruppel
marked this pull request as ready for review
June 12, 2026 17:17
jeremyruppel
force-pushed
the
jeremy/devex-277-phase2-compose
branch
from
June 12, 2026 17:20
7f35955 to
e361603
Compare
jeremyruppel
force-pushed
the
jeremy/devex-277-phase1-module-rendering
branch
from
June 12, 2026 17:20
93faa7b to
c51c7c9
Compare
This was referenced Jun 12, 2026
Contributor
Author
This was referenced Jun 12, 2026
jeremyruppel
force-pushed
the
jeremy/devex-277-phase2-compose
branch
from
June 12, 2026 21:20
e361603 to
95d959f
Compare
jeremyruppel
force-pushed
the
jeremy/devex-277-phase1-module-rendering
branch
2 times, most recently
from
June 12, 2026 21:42
1e16e96 to
c7893a9
Compare
jeremyruppel
force-pushed
the
jeremy/devex-277-phase2-compose
branch
from
June 12, 2026 21:42
95d959f to
3fda6d7
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.
jeremyruppel
force-pushed
the
jeremy/devex-277-phase1-module-rendering
branch
from
June 12, 2026 22:00
c7893a9 to
f412afb
Compare
jeremyruppel
force-pushed
the
jeremy/devex-277-phase2-compose
branch
from
June 12, 2026 22:01
3fda6d7 to
3ea2f09
Compare
zenithwolf1000
approved these changes
Jun 15, 2026
Contributor
Author
Merge activity
|
jeremyruppel
changed the base branch from
jeremy/devex-277-phase1-module-rendering
to
graphite-base/26349
June 15, 2026 13:27
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 2 of DEVEX-277 (POST /api/v2/templatebuilder/compose).
Adds the core composition and bundling logic for the template builder.
Composerenders a base template and selected modules into Terraform source files. It validates modules before rendering (rejects duplicates, ConflictsWith violations, unknown IDs, OS incompatibility), then for each module merges manifest defaults with caller-supplied variable overrides and renders the module template.mergeModuleVariablesfills in defaults for non-computed, non-sensitive variables from the manifest (with basic JSON type validation viaisSimpleJSONValue), usesnullfor non-required variables without defaults, and leaves required variables absent somissingkey=errorcatches omissions at render time.BundleTarpackages the result into a tar archive with reproducible timestamps. Writesmain.tfalways,modules.tfonly when modules are present.Conflict detection is bidirectional so module ordering in the request does not affect validation.