Skip to content

Commit

Permalink
build provider_meta feturea into provider
Browse files Browse the repository at this point in the history
  • Loading branch information
drewmullen committed Apr 25, 2022
1 parent fb57d50 commit 485b4ba
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
defaultAssumeRoleDuration = 1 * time.Hour
)

func New() tfsdk.Provider {
func New() tfsdk.ProviderWithProviderMeta {
return &AwsCloudControlApiProvider{}
}

Expand Down Expand Up @@ -355,6 +355,38 @@ func (p *AwsCloudControlApiProvider) GetDataSources(ctx context.Context) (map[st
return dataSources, diags
}

func (p *AwsCloudControlApiProvider) GetMetaSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) {
return tfsdk.Schema{
Version: 1,
Attributes: map[string]tfsdk.Attribute{
"user_agent": {
Attributes: tfsdk.ListNestedAttributes(
map[string]tfsdk.Attribute{
"product_name": {
Type: types.StringType,
Description: "Product name. At least one of `product_name` or `comment` must be set.",
Required: true,
},
"product_version": {
Type: types.StringType,
Description: "Product version. Optional, and should only be set when `product_name` is set.",
Optional: true,
},
"comment": {
Type: types.StringType,
Description: "User-Agent comment. At least one of `comment` or `product_name` must be set.",
Optional: true,
},
},
tfsdk.ListNestedAttributesOptions{},
),
Description: "Product details to append to User-Agent string in all AWS API calls.",
Optional: true,
},
},
}, nil
}

func (p *AwsCloudControlApiProvider) CloudControlApiClient(_ context.Context) *cloudcontrol.Client {
return p.ccClient
}
Expand Down

0 comments on commit 485b4ba

Please sign in to comment.