feat(coderd/templatebuilder): add exampleID->OS map and base template .tf.tmpl files#26115
Open
Conversation
… .tf.tmpl files Add the bundled exampleID to OS map for Docker, Kubernetes, and AWS EC2 Linux base templates. Create .tf.tmpl Go template files for each base template within coderd/templatebuilder/bases/, along with BaseRenderContext and RenderBaseTemplate rendering helpers. The .tf.tmpl files are independent copies of the example templates with module blocks (code-server, jetbrains) removed, since the template builder composes modules separately into modules.tf. Golden file snapshot tests verify rendered output stability. No changes to the existing examples/ directory or create-from-example path.
- Fix image parameter not consumed: when ImageOptions is set, the docker_container and kubernetes_deployment image fields now reference data.coder_parameter.container_image.value instead of the hardcoded Go template variable. - Validate exampleID in BaseTemplateFS against known base templates, returning a clear error for unknown IDs. - Unexport baseTemplates map to prevent mutation; add BaseTemplateIDs() accessor. Store DefaultContext on BaseTemplate struct to consolidate the map and switch into a single data source. - Remove unused BaseOSWindows constant (can be re-added when needed). - Rename ctx parameter to renderCtx to avoid shadowing context.Context. - Add comment documenting Variables field as reserved for DEVEX-277. - Add Kubernetes WithImageOptions test for parity with Docker. - Add BaseTemplateFS validation test for unknown IDs. - Add AllBaseTemplatesHaveDefaults test to catch forgotten entries.
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
jeremyruppel
commented
Jun 5, 2026
Comment on lines
+15
to
+16
| # Last updated 2023-03-14 | ||
| # aws ec2 describe-regions | jq -r '[.Regions[].RegionName] | sort' |
Contributor
Author
There was a problem hiding this comment.
I saw this comment and I'm honestly not sure if we should remove it or update it
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.

Add the bundled
exampleID -> OSGo map for Docker, Kubernetes, and AWS EC2 Linux base templates. Create.tf.tmplGo template files for each withincoderd/templatebuilder/bases/, along withBaseRenderContextandRenderBaseTemplaterendering helpers.The
.tf.tmplfiles are independent copies of the example templates with module blocks (code-server, jetbrains) removed, since the template builder composes modules separately intomodules.tf. WhenImageOptionsis provided, the container image field references the Terraform parameter; otherwise it uses the hardcoded value via Go template whitespace control ({{-).Golden file snapshot tests verify rendered output stability with an
-updateflag for regeneration.Depends on #25909
Note
This PR was authored by Coder Agents on behalf of @jeremyruppel.