Skip to content

Commit

Permalink
feat: update provider name to publicsuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
gmeligio committed Apr 4, 2024
1 parent 06b2bdf commit b661a9a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 53 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Terraform Provider Scaffolding (Terraform Plugin Framework)
# Terraform Provider Publicsuffix (Terraform Plugin Framework)

_This template repository is built on the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework). The template repository built on the [Terraform Plugin SDK](https://github.com/hashicorp/terraform-plugin-sdk) can be found at [terraform-provider-scaffolding](https://github.com/hashicorp/terraform-provider-scaffolding). See [Which SDK Should I Use?](https://developer.hashicorp.com/terraform/plugin/framework-benefits) in the Terraform documentation for additional information._

Expand Down
26 changes: 0 additions & 26 deletions docs/functions/example.md

This file was deleted.

41 changes: 17 additions & 24 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,34 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types"
)

// Ensure ScaffoldingProvider satisfies various provider interfaces.
var _ provider.Provider = &ScaffoldingProvider{}
var _ provider.ProviderWithFunctions = &ScaffoldingProvider{}
// Ensure PublicsuffixProvider satisfies various provider interfaces.
var _ provider.Provider = &PublicsuffixProvider{}
var _ provider.ProviderWithFunctions = &PublicsuffixProvider{}

// ScaffoldingProvider defines the provider implementation.
type ScaffoldingProvider struct {
// PublicsuffixProvider defines the provider implementation.
type PublicsuffixProvider struct {
// version is set to the provider version on release, "dev" when the
// provider is built and ran locally, and "test" when running acceptance
// testing.
version string
}

// ScaffoldingProviderModel describes the provider data model.
type ScaffoldingProviderModel struct {
// PublicsuffixProviderModel describes the provider data model.
type PublicsuffixProviderModel struct {
Endpoint types.String `tfsdk:"endpoint"`
}

func (p *ScaffoldingProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) {
resp.TypeName = "scaffolding"
func (p *PublicsuffixProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) {
resp.TypeName = "publicsuffix"
resp.Version = p.version
}

func (p *ScaffoldingProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"endpoint": schema.StringAttribute{
MarkdownDescription: "Example provider attribute",
Optional: true,
},
},
}
func (p *PublicsuffixProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{}
}

func (p *ScaffoldingProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
var data ScaffoldingProviderModel
func (p *PublicsuffixProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
var data PublicsuffixProviderModel

resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)

Expand All @@ -63,27 +56,27 @@ func (p *ScaffoldingProvider) Configure(ctx context.Context, req provider.Config
resp.ResourceData = client
}

func (p *ScaffoldingProvider) Resources(ctx context.Context) []func() resource.Resource {
func (p *PublicsuffixProvider) Resources(ctx context.Context) []func() resource.Resource {
return []func() resource.Resource{
NewExampleResource,
}
}

func (p *ScaffoldingProvider) DataSources(ctx context.Context) []func() datasource.DataSource {
func (p *PublicsuffixProvider) DataSources(ctx context.Context) []func() datasource.DataSource {
return []func() datasource.DataSource{
NewExampleDataSource,
}
}

func (p *ScaffoldingProvider) Functions(ctx context.Context) []func() function.Function {
func (p *PublicsuffixProvider) Functions(ctx context.Context) []func() function.Function {
return []func() function.Function{
NewExampleFunction,
}
}

func New(version string) func() provider.Provider {
return func() provider.Provider {
return &ScaffoldingProvider{
return &PublicsuffixProvider{
version: version,
}
}
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

// Run the docs generation tool, check its repository for more information on how it works and how docs
// can be customized.
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate -provider-name scaffolding
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate -provider-name publicsuffix

var (
// these will be set by the goreleaser configuration
Expand All @@ -38,7 +38,7 @@ func main() {
// TODO: Update this string with the published name of your provider.
// Also update the tfplugindocs generate command to either remove the
// -provider-name flag or set its value to the updated provider name.
Address: "registry.terraform.io/hashicorp/scaffolding",
Address: "registry.terraform.io/gmeligio/publicsuffix",
Debug: debug,
}

Expand Down

0 comments on commit b661a9a

Please sign in to comment.