Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Terraform Resources for Dev Containers

未关闭
#1,237 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
terraform

调研方向

首先跟踪 coder_devcontainer 资源及其与 coder_app、coder_script、coder_env 和 coder_ai_task 的交互;然后检查 devcontainer.json 中的 customizations.coder.modules 自定义项以及 coderd 的 coder/preview 路径。该 issue 描述了两个阶段,因此请在实现前确认预期范围和验收标准;完成后应包括指定的资源关联和模块配置行为。

由索引模型根据 Issue 内容生成。

描述

epic

Epic: Terraform Resources for Dev Containers

Summary

Enable template authors to attach Terraform resources (coder_app, coder_script, coder_env, coder_ai_task) to coder_devcontainer resources, eliminating the need to choose between Dev Containers and our collection of Terraform modules.

Problem Statement

Opting in to Dev Containers requires opting out of our collection of Terraform modules as there is no way of associating terraform resources to the coder_devcontainer resource.

Agents used for Dev Containers are created dynamically after workspace provisioning. Since the sub-agent doesn't exist at Terraform plan/apply time, there is no way to reference it in Terraform.

Solution Overview

Phase 1: Terraform-defined Resources

Introduce a computed subagent_id field on the coder_devcontainer resource that can be referenced by other Terraform resources. This ID is pre-computed at plan time and used when the sub-agent is created at runtime.

resource "coder_devcontainer" "main" {
  agent_id         = coder_agent.main.id
  workspace_folder = "/workspaces/project"
}

resource "coder_app" "code_server" {
  agent_id     = coder_devcontainer.main.subagent_id
  slug         = "code-server"
  display_name = "VS Code"
  url          = "http://localhost:8080"
}
Phase 2: devcontainer.json-defined Resources

Enable Terraform modules to be defined directly in devcontainer.json via customizations.coder.modules, allowing developers to attach modules to their dev container without modifying Terraform templates. The modules are provisioned by coderd using coder/preview.

{
  "customizations": {
    "coder": {
      "modules": {
        "registry.coder.com/coder/code-server/coder:1.0.0": {},
        "registry.coder.com/coder/zed/coder:1": {
          "folder": "/home/coder/coder"
        }
      }
    }
  }
}

The key format is <registry link>:<version> and the value is an object of key-value mappings where each key is translated into a Terraform variable.

主要语言
没有语言数据
星标
3
派生
0
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

coder/internal 的其他 Issue

查看 coder/internal 的全部 Issue

相似的 Issue

更多 DevOps Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。