mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -0,0 +1,32 @@
|
||||
---
|
||||
display_name: Scratch
|
||||
description: A minimal Coder workspace template with just an agent
|
||||
icon: ../../../site/static/icon/coder.svg
|
||||
maintainer_github: coder
|
||||
verified: true
|
||||
tags: [minimal, scratch]
|
||||
---
|
||||
|
||||
# Scratch Template
|
||||
|
||||
A minimal template that provisions a Coder agent with basic metadata. Use this as a starting point when you want full control over the infrastructure and just need the agent scaffolding.
|
||||
|
||||
<!-- prerequisites:start -->
|
||||
|
||||
## Prerequisites
|
||||
|
||||
This template only provisions a Coder agent. You must provide your own compute platform (e.g. Docker, a VM, Kubernetes) for the agent to run on.
|
||||
|
||||
<!-- prerequisites:end -->
|
||||
|
||||
## Architecture
|
||||
|
||||
This template provisions the following resources:
|
||||
|
||||
- Coder agent (with CPU and RAM metadata)
|
||||
- Environment variables for Git configuration
|
||||
|
||||
No infrastructure resources are included. Extend the template with your own compute resources.
|
||||
|
||||
> **Note**
|
||||
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"id": "scratch",
|
||||
"display_name": "Scratch",
|
||||
"os": "linux",
|
||||
"default_context": {}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data "coder_provisioner" "me" {}
|
||||
|
||||
data "coder_workspace" "me" {}
|
||||
|
||||
resource "coder_agent" "main" {
|
||||
arch = data.coder_provisioner.me.arch
|
||||
os = data.coder_provisioner.me.os
|
||||
|
||||
metadata {
|
||||
display_name = "CPU Usage"
|
||||
key = "0_cpu_usage"
|
||||
script = "coder stat cpu"
|
||||
interval = 10
|
||||
timeout = 1
|
||||
}
|
||||
|
||||
metadata {
|
||||
display_name = "RAM Usage"
|
||||
key = "1_ram_usage"
|
||||
script = "coder stat mem"
|
||||
interval = 10
|
||||
timeout = 1
|
||||
}
|
||||
}
|
||||
|
||||
# Use this to set environment variables in your workspace
|
||||
# details: https://registry.terraform.io/providers/coder/coder/latest/docs/resources/env
|
||||
resource "coder_env" "welcome_message" {
|
||||
agent_id = coder_agent.main.id
|
||||
name = "WELCOME_MESSAGE"
|
||||
value = "Welcome to your Coder workspace!"
|
||||
}
|
||||
Reference in New Issue
Block a user