Skip to content

Commit

Permalink
Merge pull request #17617 from hashicorp/refactor/typed-sdk-definition
Browse files Browse the repository at this point in the history
sdk: extracting the Plugin SDKv2 schema types to their own interface
  • Loading branch information
tombuildsstuff authored Jul 14, 2022
2 parents ed4fd5d + 9a035f4 commit 7abe308
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/sdk/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)

type resourceBase interface {
// resourceWithPluginSdkSchema defines the Arguments and Attributes for this resource
// using the types defined in Plugin SDKv2
type resourceWithPluginSdkSchema interface {
// Arguments is a list of user-configurable (that is: Required, Optional, or Optional and Computed)
// arguments for this Resource
Arguments() map[string]*schema.Schema

// Attributes is a list of read-only (e.g. Computed-only) attributes
Attributes() map[string]*schema.Schema
}

type resourceBase interface {
// resourceWithPluginSdkSchema ensure that the Arguments and Attributes are sourced
// from Plugin SDKv2 for now - longer term we'll likely introduce a `Typed Schema`
// which will cross-compile down to both the Plugin SDKv2 and Plugin Framework, but
// that's a story for another day.
resourceWithPluginSdkSchema

// ModelObject is an instance of the object the Schema is decoded/encoded into
ModelObject() interface{}
Expand Down

0 comments on commit 7abe308

Please sign in to comment.