<!-- Generated by Coder Agents on behalf of @Emyrk. --> <img width="762" height="239" alt="Screenshot From 2026-09-11 17-09-41" src="https://github.com/user-attachments/assets/9f31fd1e-4cb2-47ab-8d37-4073df9f0a7c" /> Closes #22834. Adds `CODER_PROVISIONER_DISABLE_MODULE_CACHE` so an admin can disable Terraform module caching for every template at once instead of toggling ~100 templates by hand. - The deployment setting wins. Templates cannot opt back in, and the per-template toggle becomes read-only while the deployment setting is on. - Modules stay cached at template import, so dynamic parameter rendering still resolves module-defined parameters. Only the workspace build is denied the cached files. - Templates report `module_cache_disabled_by_deployment`, and template settings shows why the checkbox is locked. <details><summary>Agent context</summary> Decisions taken with @Emyrk before implementing: 1. **Precedence.** `deployment || template`, no per-template override, so no migration and no nullable column. The rule lives in one place, `codersdk.ModuleCacheDisabled`. 2. **Import-time caching untouched.** `dynamicparameters/render.go` overlays `cached_module_files` at `.terraform/modules` to render module-defined parameters. Skipping the cache there would reproduce the `Module not loaded. Did you run terraform init?` failure reported by a customer, so the deployment setting only affects what `AcquireJob` hands the provisioner. 3. **Write path.** A PATCH carrying `disable_module_cache` is discarded while the deployment setting is on, rather than persisted. Persisting it would silently keep templates opted out after the deployment setting is removed. 4. **API shape.** `disable_module_cache` keeps its meaning (this template's stored value) and the new read-only `module_cache_disabled_by_deployment` reports the deployment state. Reading the effective value from `/deployment/config` was rejected because template admins may lack deployment-config read permission. 5. **Naming.** `CODER_PROVISIONER_DISABLE_MODULE_CACHE` over the issue's `CODER_DISABLE_TERRAFORM_MODULE_CACHE`, to match the provisioning option group. Note: `InsertTemplateParams` has no `disable_module_cache` binding, so new templates always store `false`. With deployment precedence they still behave as opted out, so the create path needed no change. Out of scope and tracked elsewhere: the `coderd_template` Terraform provider attribute (separate repo) and backporting the per-template toggle to `release/2.30`. </details> --- <sub>Coder Agents on behalf of @Emyrk.</sub>
353 lines
11 KiB
Markdown
Generated
353 lines
11 KiB
Markdown
Generated
---
|
|
# Code generated by make gen. DO NOT EDIT.
|
|
title: TemplateBuilder
|
|
---
|
|
|
|
<!-- DO NOT EDIT | GENERATED CONTENT -->
|
|
|
|
## List template builder base templates
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/templatebuilder/bases \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/templatebuilder/bases`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"bases": [
|
|
{
|
|
"agents": [
|
|
{
|
|
"default": true,
|
|
"display_name": "string",
|
|
"name": "string"
|
|
}
|
|
],
|
|
"description": "string",
|
|
"icon": "string",
|
|
"id": "string",
|
|
"name": "string",
|
|
"os": "string",
|
|
"prerequisites": "string",
|
|
"variables": [
|
|
{
|
|
"default": [
|
|
0
|
|
],
|
|
"description": "string",
|
|
"name": "string",
|
|
"required": true,
|
|
"sensitive": true,
|
|
"type": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TemplateBuilderBasesResponse](schemas.md#codersdktemplatebuilderbasesresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Compose template from base and modules
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/templatebuilder/compose \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/templatebuilder/compose`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"base_template_id": "string",
|
|
"base_variable_values": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"modules": [
|
|
{
|
|
"agent_name": "string",
|
|
"id": "string",
|
|
"variables": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------------------------------|----------|-----------------|
|
|
| `body` | body | [codersdk.TemplateBuilderComposeRequest](schemas.md#codersdktemplatebuildercomposerequest) | true | Compose request |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Compose and create a template
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/templatebuilder/compose/template \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/templatebuilder/compose/template`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"base_template_id": "string",
|
|
"base_variable_values": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"description": "string",
|
|
"display_name": "string",
|
|
"icon": "string",
|
|
"modules": [
|
|
{
|
|
"agent_name": "string",
|
|
"id": "string",
|
|
"variables": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
}
|
|
}
|
|
],
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"provisioner_tags": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|----------------------------------------------------------------------------------------------------------|----------|-------------------------|
|
|
| `body` | body | [codersdk.TemplateBuilderCreateTemplateRequest](schemas.md#codersdktemplatebuildercreatetemplaterequest) | true | Create template request |
|
|
|
|
### Example responses
|
|
|
|
> 201 Response
|
|
|
|
```json
|
|
{
|
|
"template": {
|
|
"active_user_count": 0,
|
|
"active_version_id": "eae64611-bd53-4a80-bb77-df1e432c0fbc",
|
|
"activity_bump_ms": 0,
|
|
"agents_allowed": true,
|
|
"allow_user_autostart": true,
|
|
"allow_user_autostop": true,
|
|
"allow_user_cancel_workspace_jobs": true,
|
|
"allow_workspace_renames": true,
|
|
"autostart_requirement": {
|
|
"days_of_week": [
|
|
"monday"
|
|
]
|
|
},
|
|
"autostop_requirement": {
|
|
"days_of_week": [
|
|
"monday"
|
|
],
|
|
"weeks": 0
|
|
},
|
|
"build_time_stats": {
|
|
"property1": {
|
|
"p50": 123,
|
|
"p95": 146
|
|
},
|
|
"property2": {
|
|
"p50": 123,
|
|
"p95": 146
|
|
}
|
|
},
|
|
"cors_behavior": "simple",
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"created_by_id": "9377d689-01fb-4abf-8450-3368d2c1924f",
|
|
"created_by_name": "string",
|
|
"default_ttl_ms": 0,
|
|
"deleted": true,
|
|
"deprecated": true,
|
|
"deprecation_message": "string",
|
|
"description": "string",
|
|
"disable_module_cache": true,
|
|
"display_name": "string",
|
|
"failure_ttl_ms": 0,
|
|
"icon": "string",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"max_port_share_level": "owner",
|
|
"module_cache_disabled_by_deployment": true,
|
|
"name": "string",
|
|
"organization_display_name": "string",
|
|
"organization_icon": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"organization_name": "string",
|
|
"provisioner": "terraform",
|
|
"require_active_version": true,
|
|
"time_til_autostop_notify_ms": 0,
|
|
"time_til_dormant_autodelete_ms": 0,
|
|
"time_til_dormant_ms": 0,
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"use_classic_parameter_flow": true
|
|
}
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------------|-----------------|------------------------------------------------------------------------------------------------------------|
|
|
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.TemplateBuilderCreateTemplateResponse](schemas.md#codersdktemplatebuildercreatetemplateresponse) |
|
|
| 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Bad Request | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | Not Found | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 409 | [Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8) | Conflict | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 504 | [Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5) | Gateway Timeout | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## List template builder modules
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/templatebuilder/modules \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/templatebuilder/modules`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|-------|--------|----------|---------------------------------------------------------|
|
|
| `base` | query | string | false | Base template example ID for OS-compatibility filtering |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"modules": [
|
|
{
|
|
"category": "string",
|
|
"compatible_os": [
|
|
"string"
|
|
],
|
|
"conflicts_with": [
|
|
"string"
|
|
],
|
|
"description": "string",
|
|
"display_name": "string",
|
|
"icon": "string",
|
|
"id": "string",
|
|
"variables": [
|
|
{
|
|
"default": [
|
|
0
|
|
],
|
|
"description": "string",
|
|
"name": "string",
|
|
"required": true,
|
|
"sensitive": true,
|
|
"type": "string"
|
|
}
|
|
],
|
|
"version": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TemplateBuilderModulesResponse](schemas.md#codersdktemplatebuildermodulesresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Report a template builder session event
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/templatebuilder/sessions \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/templatebuilder/sessions`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"base_template_id": "string",
|
|
"duration_seconds": 0,
|
|
"event_type": "wizard_entry",
|
|
"module_ids": [
|
|
"string"
|
|
],
|
|
"session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------------------------------|----------|---------------|
|
|
| `body` | body | [codersdk.TemplateBuilderSessionRequest](schemas.md#codersdktemplatebuildersessionrequest) | true | Session event |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|