Skip to content

feat(coderd_agents_mcp_server)!: import by organization name and slug - #427

Closed
ethanndickson wants to merge 1 commit into
org-chat-models/default-modelfrom
org-chat-models/mcp-import
Closed

feat(coderd_agents_mcp_server)!: import by organization name and slug#427
ethanndickson wants to merge 1 commit into
org-chat-models/default-modelfrom
org-chat-models/mcp-import

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Aug 27, 2026

Copy link
Copy Markdown
Member

Changes the coderd_agents_mcp_server import ID from <organization-id>/<id> to <organization-name>/<slug> (the organization component also accepts a UUID):

terraform import coderd_agents_mcp_server.example my-org/github-mcp

MCP server slugs are unique per organization, but the get-by-ID endpoint only accepts UUIDs, so import resolves the slug from the organization's server list. The resource hasn't shipped in a provider release, so the old UUID-composite format is dropped without a compatibility path.

Refs CODAGT-973.

Disclosure: Xum (AI agent) authored this PR on @ethanndickson's behalf.

Stack created with GitHub Stacks CLIGive Feedback 💬

@linear-code

linear-code Bot commented Aug 27, 2026

Copy link
Copy Markdown

CODAGT-973

Copy link
Copy Markdown
Member Author

Folded into #423 — this change now ships as part of that PR.

@ethanndickson
ethanndickson deleted the org-chat-models/mcp-import branch August 27, 2026 12:09
ethanndickson added a commit that referenced this pull request Aug 31, 2026
Stacked on #422.

Coder 2.37 makes the default chat model per-organization rather than
deployment-global: each organization has its own default, the first
model created in an organization is automatically promoted, and existing
configurations are migrated to the default organization. The
experimental `coderd_default_agents_model` resource modeled one global
selection and no longer matches the server.

This PR replaces it with `coderd_agents_default_model`:

- Renames the resource from `coderd_default_agents_model` to
`coderd_agents_default_model`, grouping it with `coderd_agents_model`.
- Requires an explicit `organization_id`; changing it forces
replacement.
- Uses the organization UUID as the resource `id`, since each
organization has one default.
- Create and update mark the selected model as default through the
organization-scoped `/api/v2` endpoint.
- Read lists the organization's models and resolves its current default.
- Missing or inaccessible organizations and unsupported Coder versions
produce actionable diagnostics.
- Delete remains an intentional no-op because Coder requires a default
while models exist and provides no unset-default API.

## Breaking change and migration

`coderd_default_agents_model` is removed and replaced by
`coderd_agents_default_model`. The new resource implements
`ResourceWithMoveState`, allowing existing state to migrate
declaratively:

```hcl
moved {
  from = coderd_default_agents_model.this
  to   = coderd_agents_default_model.this
}

resource "coderd_agents_default_model" "this" {
  organization_id = var.organization_id
  model_id        = coderd_agents_model.default.id
}
```

The legacy deployment-wide selection is assigned to the provider's
default organization during the move. The configured `organization_id`
should therefore identify that same organization.

Also folds in the `coderd_agents_mcp_server` import ID change
(originally #427): `<organization-name>/<slug>` instead of
`<organization-id>/<id>` (the organization component also accepts a
UUID). Slugs are unique per organization, but the get-by-ID endpoint
only accepts UUIDs, so import resolves the slug from the organization's
server list.

The resource requires Coder v2.37.0 or later. Its import ID is the
organization name (a UUID is also accepted); `model_id` is resolved
during read.

> Disclosure: Xum (AI agent) authored this PR on @ethanndickson's
behalf.

Closes CODAGT-973
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant