Files
coder/dogfood/main.tf
Atif Ali 4385cabf6d chore: bump to refactored Claude and Codex modules (#24981)
Bumps the dogfood template to the refactored Claude Code and Codex
modules and removes the Coder Tasks integration.

Claude and Codex now use slim-window app buttons that launch each tool
in its own tmux session. This replaces the task-specific `develop.sh`
and `preview` apps that were only created for Coder Tasks workspaces.

The PR also wires the OpenAI dogfood secret through the deployment
template so Codex can fall back to template configured BYOK when AI
Gateway is disabled.

Tested with this template version:
[https://dev.coder.com/templates/coder/coder/versions/outstanding_hermann97](<https://dev.coder.com/templates/coder/coder/versions/outstanding_hermann97>)
2026-05-06 17:05:34 +05:00

204 lines
5.6 KiB
Terraform

terraform {
required_providers {
coderd = {
source = "coder/coderd"
version = ">= 0.0.13"
}
}
backend "gcs" {
bucket = "coder-dogfood-tf-state"
}
}
import {
to = coderd_template.envbuilder_dogfood
id = "e75f1212-834c-4183-8bed-d6817cac60a5"
}
import {
to = coderd_template.vscode_coder
id = "2d5caceb-c6a3-4c46-a81d-005d92b83ffd"
}
data "coderd_organization" "default" {
is_default = true
}
data "coderd_user" "machine" {
username = "machine"
}
variable "CODER_TEMPLATE_NAME" {
type = string
}
variable "CODER_TEMPLATE_VERSION" {
type = string
}
variable "CODER_TEMPLATE_DIR" {
type = string
}
variable "CODER_TEMPLATE_MESSAGE" {
type = string
}
variable "CODER_DOGFOOD_ANTHROPIC_API_KEY" {
type = string
description = "The API key that workspaces will use to authenticate with the Anthropic API."
default = ""
sensitive = true
}
variable "CODER_DOGFOOD_OPENAI_API_KEY" {
type = string
description = "The API key that workspaces will use to authenticate with the OpenAI API."
default = ""
sensitive = true
}
resource "coderd_template" "dogfood" {
name = var.CODER_TEMPLATE_NAME
display_name = "Write Coder on Coder"
description = "The template to use when developing Coder on Coder!"
icon = "/emojis/1f3c5.png"
organization_id = data.coderd_organization.default.id
versions = [
{
name = var.CODER_TEMPLATE_VERSION
message = var.CODER_TEMPLATE_MESSAGE
directory = var.CODER_TEMPLATE_DIR
active = true
tf_vars = [
{
name = "anthropic_api_key"
value = var.CODER_DOGFOOD_ANTHROPIC_API_KEY
},
{
name = "openai_api_key"
value = var.CODER_DOGFOOD_OPENAI_API_KEY
}
]
}
]
acl = {
groups = [{
id = data.coderd_organization.default.id
role = "use"
}]
users = [{
id = data.coderd_user.machine.id
role = "admin"
}]
}
activity_bump_ms = 10800000
allow_user_auto_start = true
allow_user_auto_stop = true
allow_user_cancel_workspace_jobs = false
auto_start_permitted_days_of_week = ["friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"]
auto_stop_requirement = {
days_of_week = ["sunday"]
weeks = 1
}
default_ttl_ms = 28800000
deprecation_message = null
failure_ttl_ms = 604800000
require_active_version = true
time_til_dormant_autodelete_ms = 7776000000
time_til_dormant_ms = 8640000000
}
resource "coderd_template" "vscode_coder" {
name = "vscode-coder"
display_name = "Write Coder VS Code Extension on Coder"
description = "Develop the coder/vscode-coder VS Code extension on Coder."
icon = "/icon/code.svg"
organization_id = data.coderd_organization.default.id
versions = [
{
name = var.CODER_TEMPLATE_VERSION
message = var.CODER_TEMPLATE_MESSAGE
directory = "./vscode-coder"
active = true
tf_vars = [
{
name = "anthropic_api_key"
value = var.CODER_DOGFOOD_ANTHROPIC_API_KEY
}
]
}
]
acl = {
groups = [{
id = data.coderd_organization.default.id
role = "use"
}]
users = [{
id = data.coderd_user.machine.id
role = "admin"
}]
}
activity_bump_ms = 10800000
allow_user_auto_start = true
allow_user_auto_stop = true
allow_user_cancel_workspace_jobs = false
auto_start_permitted_days_of_week = ["friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"]
auto_stop_requirement = {
days_of_week = ["sunday"]
weeks = 1
}
default_ttl_ms = 28800000
deprecation_message = null
failure_ttl_ms = 604800000
require_active_version = true
time_til_dormant_autodelete_ms = 7776000000
time_til_dormant_ms = 8640000000
}
resource "coderd_template" "envbuilder_dogfood" {
name = "coder-envbuilder"
display_name = "Write Coder on Coder using Envbuilder"
description = "Write Coder on Coder using a workspace built by Envbuilder."
icon = "/emojis/1f3d7.png" # 🏗️
organization_id = data.coderd_organization.default.id
versions = [
{
name = var.CODER_TEMPLATE_VERSION
message = var.CODER_TEMPLATE_MESSAGE
directory = "./coder-envbuilder"
active = true
tf_vars = [{
# clusters/dogfood-v2/coder/provisioner/configs/values.yaml#L191-L194
name = "envbuilder_cache_dockerconfigjson_path"
value = "/home/coder/envbuilder-cache-dockerconfig.json"
}]
}
]
acl = {
groups = [{
id = data.coderd_organization.default.id
role = "use"
}]
users = [{
id = data.coderd_user.machine.id
role = "admin"
}]
}
activity_bump_ms = 10800000
allow_user_auto_start = true
allow_user_auto_stop = true
allow_user_cancel_workspace_jobs = false
auto_start_permitted_days_of_week = ["friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"]
auto_stop_requirement = {
days_of_week = ["sunday"]
weeks = 1
}
default_ttl_ms = 28800000
deprecation_message = null
failure_ttl_ms = 604800000
require_active_version = true
time_til_dormant_autodelete_ms = 7776000000
time_til_dormant_ms = 8640000000
}