refactor(coder-labs/sourcegraph-amp): support terraform provider coder v2.12.0 (#495)

## Description

Updates the module to use the new version of the agentapi module for
Coder 2.28

## Type of Change

- [ ] New module
- [ ] New template
- [ ] Bug fix
- [x] Feature/enhancement
- [ ] Documentation
- [ ] Other

## Module Information

**Path:** `registry/coder-labs/modules/sourcegraph-amp`  
**New version:** `v3.0.0`  
**Breaking change:** [x] Yes [ ] No

## Testing & Validation

- [x] Tests pass (`bun test`)
- [x] Code formatted (`bun fmt`)
- [ ] Changes tested locally

## Related Issues

- https://github.com/coder/internal/issues/1065

## Related PRs

- https://github.com/coder/registry/pull/485

---------

Co-authored-by: DevCats <christofer@coder.com>
This commit is contained in:
Danielle Maywood 2025-12-17 17:54:28 +00:00 committed by GitHub
parent 631bf027c6
commit f66f61d724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 7 deletions

View File

@ -13,7 +13,7 @@ Run [Amp CLI](https://ampcode.com/) in your workspace to access Sourcegraph's AI
```tf ```tf
module "amp-cli" { module "amp-cli" {
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder" source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
version = "2.1.0" version = "3.0.0"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
amp_api_key = var.amp_api_key amp_api_key = var.amp_api_key
install_amp = true install_amp = true
@ -48,7 +48,7 @@ variable "amp_api_key" {
module "amp-cli" { module "amp-cli" {
count = data.coder_workspace.me.start_count count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder" source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
amp_version = "2.1.0" amp_version = "3.0.0"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
amp_api_key = var.amp_api_key # recommended for tasks usage amp_api_key = var.amp_api_key # recommended for tasks usage
workdir = "/home/coder/project" workdir = "/home/coder/project"

View File

@ -110,6 +110,7 @@ describe("amp", async () => {
const { id } = await setup({ const { id } = await setup({
skipAmpMock: true, skipAmpMock: true,
moduleVariables: { moduleVariables: {
install_via_npm: "true",
amp_version: "0.0.1755964909-g31e083", amp_version: "0.0.1755964909-g31e083",
}, },
}); });

View File

@ -4,7 +4,7 @@ terraform {
required_providers { required_providers {
coder = { coder = {
source = "coder/coder" source = "coder/coder"
version = ">= 2.7" version = ">= 2.12"
} }
external = { external = {
source = "hashicorp/external" source = "hashicorp/external"
@ -140,7 +140,7 @@ variable "base_amp_config" {
type = string type = string
description = <<-EOT description = <<-EOT
Base AMP configuration in JSON format. Can be overridden to customize AMP settings. Base AMP configuration in JSON format. Can be overridden to customize AMP settings.
If empty, defaults enable thinking and todos for autonomous operation. Additional options include: If empty, defaults enable thinking and todos for autonomous operation. Additional options include:
- "amp.permissions": [] (tool permissions) - "amp.permissions": [] (tool permissions)
- "amp.tools.stopTimeout": 600 (extend timeout for long operations) - "amp.tools.stopTimeout": 600 (extend timeout for long operations)
@ -148,7 +148,7 @@ variable "base_amp_config" {
- "amp.tools.disable": ["builtin:open"] (disable tools for containers) - "amp.tools.disable": ["builtin:open"] (disable tools for containers)
- "amp.git.commit.ampThread.enabled": true (link commits to threads) - "amp.git.commit.ampThread.enabled": true (link commits to threads)
- "amp.git.commit.coauthor.enabled": true (add Amp as co-author) - "amp.git.commit.coauthor.enabled": true (add Amp as co-author)
Reference: https://ampcode.com/manual Reference: https://ampcode.com/manual
EOT EOT
default = "" default = ""
@ -220,7 +220,7 @@ locals {
module "agentapi" { module "agentapi" {
source = "registry.coder.com/coder/agentapi/coder" source = "registry.coder.com/coder/agentapi/coder"
version = "1.2.0" version = "2.0.0"
agent_id = var.agent_id agent_id = var.agent_id
folder = local.workdir folder = local.workdir
@ -268,4 +268,6 @@ module "agentapi" {
EOT EOT
} }
output "task_app_id" {
value = module.agentapi.task_app_id
}