New Features
- Framework Diagnostics Error Support: Added
terraform/errors.FrameworkDiagnosticsErrorto convert Terraform plugin framework diagnostic error messages into Go errors. This enhancement improves error handling and debugging capabilities when working with Terraform plugin framework resources. - Framework Resource Identity Configuration: Introduced
config.FrameworkResourceWithComputedIdentifierexternal-name configuration specifically designed for Terraform plugin framework resources with computed identifier fields. This feature includes a newconfig.ExternalName.TFPluginFrameworkOptionsstruct for grouping framework-related configuration options and ComputedIdentifierAttributes to exclude computed identifier fields during drift calculations between desired and actual states. - Struct Tag Package & InitProvider Overrides: Added comprehensive pkg/types/structtag package providing a typed struct tag model with parsing, override capabilities, and validation. This enables per-field InitProvider overrides through
config.InitProviderOverrideswith both Kubebuilder marker and struct tag overrides. JSON tag values are now validated using regex patterns to prevent invalid CRD field names, and nil values in initProvider are properly handled to avoid spurious plan diffs. - Enhanced Tag Override System: Introduced structtag.Value.OverrideFrom method for overriding struct tags from another source, along with
config.SchemaElementOption.InitProviderTagOverridesto customize generated tags for InitProvider types. This provides fine-grained control over code generation and CRD field specifications.
Bug Fixes
Critical Race Condition Fix - Conversion Webhooks
This release resolves a critical race condition in conversion path registration that was causing intermittent failures in provider packages.
Technical Details:
- Problem: A data race existed in the conversion.Convert method where multiple goroutines could simultaneously modify registered conversion paths during in-place sorting
- Impact: This race condition was observed in provider packages and could cause unexpected conversion webhook failures
- Solution: Fixed by creating a copy of registered conversion paths before performing in-place sorting, preventing concurrent modifications
This fix addresses reliability issues that users may have experienced with conversion webhooks, particularly in high-load environments or during rapid resource operations.
What's Changed
- Fix the race on the registered conversion paths in conversion.Convert by @ulucinar in #545
- Add per-field InitProvider tag & kubebuilder marker overrides by @ulucinar in #544
- linter: suppress linter false positives on switch-case by @erhancagirici in #550
- Add config.FrameworkResourceWithComputedIdentifier external-name configuration by @ulucinar in #549
- Add terraform/errors.FrameworkDiagnosticsError by @ulucinar in #551
Full Changelog: v2.1.0...v2.2.0