@@ -637,6 +637,7 @@ type DeleteContextFunc func(context.Context, *ResourceData, interface{}) diag.Di
637637type StateMigrateFunc func (
638638 int , * terraform.InstanceState , interface {}) (* terraform.InstanceState , error )
639639
640+ // Implementation of a single schema version state upgrade.
640641type StateUpgrader struct {
641642 // Version is the version schema that this Upgrader will handle, converting
642643 // it to Version+1.
@@ -655,7 +656,36 @@ type StateUpgrader struct {
655656 Upgrade StateUpgradeFunc
656657}
657658
658- // See StateUpgrader
659+ // Function signature for a schema version state upgrade handler.
660+ //
661+ // The Context parameter stores SDK information, such as loggers. It also
662+ // is wired to receive any cancellation from Terraform such as a system or
663+ // practitioner sending SIGINT (Ctrl-c).
664+ //
665+ // The map[string]interface{} parameter contains the previous schema version
666+ // state data for a managed resource instance. The keys are top level attribute
667+ // or block names mapped to values that can be type asserted similar to
668+ // fetching values using the ResourceData Get* methods:
669+ //
670+ // - TypeBool: bool
671+ // - TypeFloat: float
672+ // - TypeInt: int
673+ // - TypeList: []interface{}
674+ // - TypeMap: map[string]interface{}
675+ // - TypeSet: *Set
676+ // - TypeString: string
677+ //
678+ // In certain scenarios, the map may be nil, so checking for that condition
679+ // upfront is recommended to prevent potential panics.
680+ //
681+ // The interface{} parameter is the result of the Provider type
682+ // ConfigureFunc field execution. If the Provider does not define
683+ // a ConfigureFunc, this will be nil. This parameter is conventionally
684+ // used to store API clients and other provider instance specific data.
685+ //
686+ // The map[string]interface{} return parameter should contain the upgraded
687+ // schema version state data for a managed resource instance. Values must
688+ // align to the typing mentioned above.
659689type StateUpgradeFunc func (ctx context.Context , rawState map [string ]interface {}, meta interface {}) (map [string ]interface {}, error )
660690
661691// See Resource documentation.
0 commit comments