Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Aug 17, 2022
1 parent 6bdaf93 commit 9f13bc3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
19 changes: 10 additions & 9 deletions internal/provider/fwprovider/provider.go
Expand Up @@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions internal/service/meta/arn_data_source_fw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/service/meta/svcimpl.go
Expand Up @@ -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)) {
}

0 comments on commit 9f13bc3

Please sign in to comment.