terraform-provider-coder
terraform-provider-coder copied to clipboard
feat: implement inline version metadata system for new resources
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
Descriptionfields using@since:vX.Y.Zmarkers - 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.goextracts@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
- Provider v2.0 as baseline: Only resources added after terraform-provider-coder v2.0.1 show version requirements
- Single format: Uses
@since:consistently for both resources and attributes - Explicit markers only: No default versions - only resources with markers show version info
- 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