coder / coder/terraform-provider-coderd
feat: Add `disable_module_cache` attribute to `coderd_template` resource
- Dominant language
- Go
- Stars
- 29
- Forks
- 13
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 20
Description
## Summary
The `coderd_template` resource does not currently expose the `disable_module_cache` attribute, which was added to the Coder API in coder/coder#21931 (v2.31+). This means templates managed via Terraform have no way to control this setting.
## Context
Since v2.30 (coder/coder#21398), Terraform modules are cached at template import time and reused for all subsequent workspace builds. A per-template toggle `disable_module_cache` was added in coder/coder#21931 to allow opting out of this behavior.
The setting is available via:
- The Coder UI (Template Settings)
- The REST API (`PATCH /api/v2/templates/{id}` with `disable_module_cache: true`)
But it is **not** available via the `coderd_template` Terraform resource, which is the primary way many teams manage their templates as code.
## Related
- coder/coder#22834 — Tracks the broader gaps: deployment-level flag, TF provider support, v2.30 backport
- coder/coder#22531 — Related bug where module caching breaks relative-path file inclusion
## API Reference
The Coder SDK already supports this field:
- `codersdk.UpdateTemplateMeta.DisableModuleCache` (`*bool`, JSON: `disable_module_cache`)
- Endpoint: `PATCH /api/v2/templates/{id}`
## Proposed Change
Add a `disable_module_cache` boolean attribute to the `TemplateResourceModel` struct in `internal/provider/template_resource.go`, following the same pattern as the recently added `cors_behavior` (#293) and `use_classic_parameter_flow` attributes.
Default should be `false` (caching enabled) to match the server-side default.
---
Filed on behalf of @bjornrobertsson
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.