terraform-provider-coder icon indicating copy to clipboard operation
terraform-provider-coder copied to clipboard

feat: implement inline version metadata system for new resources

Open blink-so[bot] opened this issue 5 months ago • 0 comments

Fixes #272

This PR implements an inline version metadata system for documenting the minimum Coder version required for resources and features introduced after terraform-provider-coder v2.0.

Implementation

1. Inline Version Metadata

  • Version requirements are embedded in Description fields using @since:vX.Y.Z markers
  • Only resources/features added after terraform-provider-coder v2.0.1 (December 4, 2024) have version markers
  • No external registry files - version info stays with the code

2. Automated Documentation Generation

  • Enhanced scripts/docsgen/main.go extracts @since: markers
  • Adds formatted version notes only to resources with explicit markers
  • Adds inline *(since vX.Y.Z)* markers to new attributes
  • No version info shown for resources that existed before provider v2.0

3. Version Compatibility Matrix

  • Added to templates/index.md.tmpl
  • Shows provider versions mapped to minimum Coder versions
  • Documents major features in each release

Resources with Version Requirements

Only resources/features introduced after terraform-provider-coder v2.0.1 show version requirements:

  • coder_ai_task - v2.24.0 (added June 19, 2025)
  • coder_devcontainer - v2.21.0 (added March 20, 2025)
  • coder_workspace_preset - v2.8.0 (added February 4, 2025)

Note: The coder_app.hidden attribute was added in September 2024 (before provider v2.0.1) and therefore does not have a version marker.

Examples

New Resource (added after provider v2.0)

Description: "Define a Dev Container. @since:v2.21.0",

Generates:

~> **Note:** This resource requires [Coder v2.21.0](...) or later.

New Attribute (if added after provider v2.0)

Description: "New feature description. @since:v2.25.0",

Generates:

- `new_feature` (Boolean) New feature description. *(since v2.25.0)*

Key Design Decisions

  1. Provider v2.0 as baseline: Only resources added after terraform-provider-coder v2.0.1 show version requirements
  2. Single format: Uses @since: consistently for both resources and attributes
  3. Explicit markers only: No default versions - only resources with markers show version info
  4. Developer-friendly: Version info lives in the code, making it hard to forget

Testing

  • ✅ Verified resources from before provider v2.0 don't show version requirements
  • ✅ Confirmed new resources (added after provider v2.0) show appropriate version notes
  • ✅ Tested attribute version markers work correctly
  • ✅ Validated documentation generation process

Developer Documentation

provider/VERSION_METADATA.md explains:

  • When to add version markers (only for features added after terraform-provider-coder v2.0)
  • How to use the @since: format
  • Best practices for version documentation

blink-so[bot] avatar Jun 27 '25 14:06 blink-so[bot]