Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions docs/resources/chat_system_prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "coderd_chat_system_prompt Resource - terraform-provider-coderd"
subcategory: ""
description: |-
~> This resource is experimental. Changes are to be expected, and we recommend using it with caution in production environments.
The deployment-wide chat system prompt for Coder Agents (Settings → Instructions in the dashboard).
This is a deployment-wide singleton. Declare it once; duplicate resources silently overwrite each other.
Coder sanitizes the stored prompt (strips invisible Unicode characters, normalizes line endings, collapses runs of blank lines, and trims surrounding whitespace), and this resource compares values the same way, so a trailing newline from file(...) does not cause drift after apply. On the first plan after an import, a configured value that differs from the live one only by sanitization shows a single in-place normalization update and then converges; use trimspace(file(...)) to avoid even that.
~> Warning
If a system prompt was configured out of band, terraform import this resource before the first apply. Otherwise Terraform overwrites the live value; a plan-time warning is emitted when this is about to happen.
~> Warning
terraform destroy resets the prompt to empty and include_default_system_prompt to true, the defaults of a never-configured deployment. The API has no delete operation for this setting.
~> Warning
This resource requires Coder version 2.32.0 https://github.com/coder/coder/releases/tag/v2.32.0 or later, and a token with site-wide owner permissions.
---

# coderd_chat_system_prompt (Resource)

~> This resource is experimental. Changes are to be expected, and we recommend using it with caution in production environments.

The deployment-wide chat system prompt for Coder Agents (`Settings → Instructions` in the dashboard).

This is a deployment-wide singleton. Declare it once; duplicate resources silently overwrite each other.

Coder sanitizes the stored prompt (strips invisible Unicode characters, normalizes line endings, collapses runs of blank lines, and trims surrounding whitespace), and this resource compares values the same way, so a trailing newline from `file(...)` does not cause drift after apply. On the first plan after an import, a configured value that differs from the live one only by sanitization shows a single in-place normalization update and then converges; use `trimspace(file(...))` to avoid even that.

~> **Warning**
If a system prompt was configured out of band, `terraform import` this resource before the first apply. Otherwise Terraform overwrites the live value; a plan-time warning is emitted when this is about to happen.

~> **Warning**
`terraform destroy` resets the prompt to empty and `include_default_system_prompt` to `true`, the defaults of a never-configured deployment. The API has no delete operation for this setting.

~> **Warning**
This resource requires Coder version [2.32.0](https://github.com/coder/coder/releases/tag/v2.32.0) or later, and a token with site-wide `owner` permissions.

## Example Usage

```terraform
// Keep the prompt itself in a Markdown file next to the Terraform
// configuration so it can be reviewed like any other prose.
resource "coderd_chat_system_prompt" "this" {
system_prompt = file("${path.module}/system-prompt.md")

// Append to Coder's built-in system prompt (the default) rather
// than replacing it.
include_default_system_prompt = true
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `system_prompt` (String) The custom system prompt text, typically `file("${path.module}/system-prompt.md")`. Limited to 128 KiB after sanitization.

### Optional

- `include_default_system_prompt` (Boolean) Whether the custom prompt is appended to Coder's built-in system prompt (`true`, the default) or replaces it entirely (`false`).

## Import

Import is supported using the following syntax:

The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:

```shell
# The chat system prompt is a deployment-wide singleton, so the import ID is
# required by the CLI syntax but otherwise unused.
terraform import coderd_chat_system_prompt.this chat_system_prompt
```
3 changes: 3 additions & 0 deletions examples/resources/coderd_chat_system_prompt/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The chat system prompt is a deployment-wide singleton, so the import ID is
# required by the CLI syntax but otherwise unused.
terraform import coderd_chat_system_prompt.this chat_system_prompt
9 changes: 9 additions & 0 deletions examples/resources/coderd_chat_system_prompt/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Keep the prompt itself in a Markdown file next to the Terraform
// configuration so it can be reviewed like any other prose.
resource "coderd_chat_system_prompt" "this" {
system_prompt = file("${path.module}/system-prompt.md")

// Append to Coder's built-in system prompt (the default) rather
// than replacing it.
include_default_system_prompt = true
}
Loading