Skip to content

feat: Add disable_module_cache attribute to coderd_template resource #332

@blinkagent

Description

@blinkagent

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions