feat: add base templates for all major cloud providers (#26634)

Add 6 new base templates to the template builder, covering all major
cloud providers and platforms:

- **scratch**: Minimal starter template with only `coder_agent` and
metadata
- **aws-windows**: AWS EC2 Windows instances with PowerShell user_data
- **azure-linux**: Azure VMs with cloud-init and managed disk
persistence
- **gcp-linux**: Google Compute Engine Linux instances with persistent
disk
- **gcp-windows**: Google Compute Engine Windows instances
- **digitalocean-linux**: DigitalOcean Linux droplets with persistent
volumes

Each base includes `base.json`, `main.tf.tmpl`, `README.md` (with
prerequisite markers), and any static files (cloud-init configs). Tests
verify all 9 bases load, render without error, and produce valid
single-agent declarations.

`azure-windows` is deferred; it needs to be registered in the `examples`
package first.

Depends on #26633

> [!NOTE]
> This PR was authored by Coder Agents on behalf of @jeremyruppel.

---

NB: This is very much an agent-generated PR and draws completely from
base templates that exist in `examples/templates/`. The base.json files
are new, so review those, but don't spend any brain tokens on the
correctness of the terraform and supporting files: any issues there are
issues with the upstream example template
This commit is contained in:
Jeremy Ruppel
2026-06-30 18:26:31 -04:00
committed by GitHub
parent 6f0b81cfbc
commit c40b3b9bcb
30 changed files with 2837 additions and 25 deletions
+24
View File
@@ -270,6 +270,24 @@ func TestModuleTemplateFS(t *testing.T) {
})
}
func TestAllBasesRenderAndExtractAgent(t *testing.T) {
t.Parallel()
for _, id := range templatebuilder.BaseTemplateIDs() {
t.Run(id, func(t *testing.T) {
t.Parallel()
renderCtx := templatebuilder.DefaultBaseRenderContext(id)
rendered, err := templatebuilder.RenderBaseTemplate(id, "main.tf.tmpl", renderCtx)
require.NoError(t, err, "base %q should render without error", id)
require.NotEmpty(t, rendered)
name, err := templatebuilder.ExtractAgentResourceName(rendered)
require.NoError(t, err, "base %q should have exactly one coder_agent", id)
require.NotEmpty(t, name)
})
}
}
func TestBaseTemplateSnapshot(t *testing.T) {
t.Parallel()
@@ -279,6 +297,12 @@ func TestBaseTemplateSnapshot(t *testing.T) {
{exampleID: "docker"},
{exampleID: "kubernetes"},
{exampleID: "aws-linux"},
{exampleID: "aws-windows"},
{exampleID: "azure-linux"},
{exampleID: "digitalocean-linux"},
{exampleID: "gcp-linux"},
{exampleID: "gcp-windows"},
{exampleID: "scratch"},
}
for _, tc := range tests {