-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Sometimes, the value of an attribute depends on whether another attribute's value is updated. It would be nice to have a UseStateForUnknownIf(...)
function, similar to RequiresReplaceIf(...)
, to mark an attribute as unknown during an update operation if the attribute it depends on has been changed; otherwise, marking it as known.
func (r *MyResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"a": schema.StringAttribute{
Required: true,
},
"b_depending_on_a": schema.StringAttribute{
Optional: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknownIf(
func(ctx context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.UseStateForUnknownIfFuncResponse) {
// ...
},
),,
},
},
},
}
}
rainkwan
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request