diff --git a/internal/provider/fwprovider/provider.go b/internal/provider/fwprovider/provider.go index 4ad98ab61513..7c12592986b5 100644 --- a/internal/provider/fwprovider/provider.go +++ b/internal/provider/fwprovider/provider.go @@ -4,6 +4,7 @@ import ( "context" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-provider-aws/internal/service/meta" @@ -12,18 +13,18 @@ import ( // New returns a new, initialized Terraform Plugin Framework-style provider instance. // The provider instance is fully configured once the `Configure` method has been called. -func New(primary interface{ Meta() interface{} }) tfsdk.Provider { - return &provider{ +func New(primary interface{ Meta() interface{} }) provider.Provider { + return &fwprovider{ Primary: primary, } } -type provider struct { +type fwprovider struct { Primary interface{ Meta() interface{} } } // GetSchema returns the schema for this provider's configuration. -func (p *provider) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) { +func (p *fwprovider) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) { var diags diag.Diagnostics // This schema must match exactly the Terraform Protocol v5 (Terraform Plugin SDK v2) provider's schema. @@ -291,24 +292,24 @@ func (p *provider) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostic // Configure is called at the beginning of the provider lifecycle, when // Terraform sends to the provider the values the user specified in the // provider configuration block. -func (p *provider) Configure(ctx context.Context, request tfsdk.ConfigureProviderRequest, response *tfsdk.ConfigureProviderResponse) { +func (p *fwprovider) Configure(ctx context.Context, request provider.ConfigureRequest, response *provider.ConfigureResponse) { // Provider's parsed configuration (its instance state) is available through the primary provider's Meta() method. } // GetResources returns a mapping of resource names to type // implementations. -func (p *provider) GetResources(ctx context.Context) (map[string]tfsdk.ResourceType, diag.Diagnostics) { +func (p *fwprovider) GetResources(ctx context.Context) (map[string]provider.ResourceType, diag.Diagnostics) { var diags diag.Diagnostics - resources := make(map[string]tfsdk.ResourceType) + resources := make(map[string]provider.ResourceType) return resources, diags } // GetDataSources returns a mapping of data source name to types // implementations. -func (p *provider) GetDataSources(ctx context.Context) (map[string]tfsdk.DataSourceType, diag.Diagnostics) { +func (p *fwprovider) GetDataSources(ctx context.Context) (map[string]provider.DataSourceType, diag.Diagnostics) { var diags diag.Diagnostics - dataSources := make(map[string]tfsdk.DataSourceType) + dataSources := make(map[string]provider.DataSourceType) // TODO: This should be done via service-level self-registration and initializatin in the primary provider. t, err := meta.NewDataSourceARNType(ctx) diff --git a/internal/service/meta/arn_data_source_fw.go b/internal/service/meta/arn_data_source_fw.go index beebfa77b6b2..515068e70b71 100644 --- a/internal/service/meta/arn_data_source_fw.go +++ b/internal/service/meta/arn_data_source_fw.go @@ -5,7 +5,9 @@ package meta import ( "context" + "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -19,7 +21,7 @@ func init() { } // newDataSourceARNType instantiates a new DataSourceType for the aws_arn data source. -func newDataSourceARNType(ctx context.Context) (tfsdk.DataSourceType, error) { +func newDataSourceARNType(ctx context.Context) (provider.DataSourceType, error) { return &dataSourceARNType{}, nil } @@ -65,15 +67,15 @@ func (t *dataSourceARNType) GetSchema(context.Context) (tfsdk.Schema, diag.Diagn } // NewDataSource instantiates a new DataSource of this DataSourceType. -func (t *dataSourceARNType) NewDataSource(ctx context.Context, provider tfsdk.Provider) (tfsdk.DataSource, diag.Diagnostics) { +func (t *dataSourceARNType) NewDataSource(ctx context.Context, provider provider.Provider) (datasource.DataSource, diag.Diagnostics) { return &dataSourceARN{}, nil } type dataSourceARN struct{} // Read is called when the provider must read data source values in order to update state. -// Config values should be read from the ReadDataSourceRequest and new state values set on the ReadDataSourceResponse. -func (d *dataSourceARN) Read(ctx context.Context, request tfsdk.ReadDataSourceRequest, response *tfsdk.ReadDataSourceResponse) { +// Config values should be read from the ReadRequest and new state values set on the ReadResponse. +func (d *dataSourceARN) Read(ctx context.Context, request datasource.ReadRequest, response *datasource.ReadResponse) { tflog.Trace(ctx, "dataSourceARN.Read enter") var config dataSourceARNData diff --git a/internal/service/meta/svcimpl.go b/internal/service/meta/svcimpl.go index 82422e746bc0..d9eeecc0b7eb 100644 --- a/internal/service/meta/svcimpl.go +++ b/internal/service/meta/svcimpl.go @@ -3,8 +3,8 @@ package meta import ( "context" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" + "github.com/hashicorp/terraform-plugin-framework/provider" ) -func registerDataSourceTypeFactory(name string, factory func(context.Context) (tfsdk.DataSourceType, error)) { +func registerDataSourceTypeFactory(name string, factory func(context.Context) (provider.DataSourceType, error)) { }