Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resource/schema/planmodifier: New type-specific plan modifiers package (
#557) Reference: #132 As part of upcoming effort to split schema functionality into the `datasource`, `provider`, and `resource` packages, there are some improvements that will land in the new implementations rather than breaking the existing `tfsdk` package schema functionality. One area which has caused developer burden is that "attribute" plan modifiers, currently implementations of the `tfsdk.AttributePlanModifier` interface, receive generic `attr.Value` as the configuration, plan, and state values to perform modification logic. This means that implementors must currently handle validating and converting the value into the concrete type they expect. The upcoming split schemas handling will introduce separate attribute/block types that will enable to framework to strongly type validators and other future schema enhancements. This change prepares the exported interfaces and internal validation logic for those enhancements. Plan modifiers are only available for resources, so this package is explicitly placed under that structure to further reduce usage confusion.
- Loading branch information
Showing
46 changed files
with
15,432 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:feature | ||
resource/schema/planmodifier: New package which contains type-specific schema plan modifier interfaces | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
internal/fwschema/fwxschema/nested_attribute_object_plan_modification.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package fwxschema | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-framework/internal/fwschema" | ||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" | ||
) | ||
|
||
// NestedAttributeObjectWithPlanModifiers is an optional interface on | ||
// NestedAttributeObject which enables Object plan modification support. | ||
type NestedAttributeObjectWithPlanModifiers interface { | ||
fwschema.NestedAttributeObject | ||
|
||
// ObjectPlanModifiers should return a list of Object plan modifiers. | ||
ObjectPlanModifiers() []planmodifier.Object | ||
} |
15 changes: 15 additions & 0 deletions
15
internal/fwschema/fwxschema/nested_block_object_plan_modification.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package fwxschema | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-framework/internal/fwschema" | ||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" | ||
) | ||
|
||
// NestedBlockObjectWithPlanModifiers is an optional interface on | ||
// NestedBlockObject which enables Object plan modification support. | ||
type NestedBlockObjectWithPlanModifiers interface { | ||
fwschema.NestedBlockObject | ||
|
||
// ObjectPlanModifiers should return a list of Object plan modifiers. | ||
ObjectPlanModifiers() []planmodifier.Object | ||
} |
Oops, something went wrong.