Skip to content

Commit

Permalink
Clean up scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino committed Jul 13, 2024
1 parent ce74cff commit 4175e4a
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 223 deletions.
21 changes: 0 additions & 21 deletions .copywrite.hcl

This file was deleted.

10 changes: 2 additions & 8 deletions docs/data-sources/example.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding_example Data Source - scaffolding"
page_title: "netboxbgp_example Data Source - netboxbgp"
subcategory: ""
description: |-
Example data source
---

# scaffolding_example (Data Source)
# netboxbgp_example (Data Source)

Example data source

## Example Usage

```terraform
data "scaffolding_example" "example" {
configurable_attribute = "some-value"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
26 changes: 0 additions & 26 deletions docs/functions/example.md

This file was deleted.

6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding Provider"
page_title: "netboxbgp Provider"
subcategory: ""
description: |-
---

# scaffolding Provider
# netboxbgp Provider



## Example Usage

```terraform
provider "scaffolding" {
provider "netboxbgp" {
# example configuration here
}
```
Expand Down
10 changes: 2 additions & 8 deletions docs/resources/example.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding_example Resource - scaffolding"
page_title: "netboxbgp_example Resource - netboxbgp"
subcategory: ""
description: |-
Example resource
---

# scaffolding_example (Resource)
# netboxbgp_example (Resource)

Example resource

## Example Usage

```terraform
resource "scaffolding_example" "example" {
configurable_attribute = "some-value"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
provider "scaffolding" {
provider "netboxbgp" {
# example configuration here
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hashicorp/terraform-provider-scaffolding-framework
module github.com/ffddorf/terraform-provider-netbox-bgp

go 1.21
go 1.22

require (
github.com/hashicorp/terraform-plugin-docs v0.19.4
Expand Down
50 changes: 0 additions & 50 deletions internal/provider/example_function.go

This file was deleted.

78 changes: 0 additions & 78 deletions internal/provider/example_function_test.go

This file was deleted.

36 changes: 14 additions & 22 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,34 @@ import (
"net/http"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/function"
"github.com/hashicorp/terraform-plugin-framework/provider"
"github.com/hashicorp/terraform-plugin-framework/provider/schema"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/types"
)

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

// ScaffoldingProvider defines the provider implementation.
type ScaffoldingProvider struct {
// NetboxBGPProvider defines the provider implementation.
type NetboxBGPProvider 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 {
// NetboxBGPProviderModel describes the provider data model.
type NetboxBGPProviderModel struct {
Endpoint types.String `tfsdk:"endpoint"`
}

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

func (p *ScaffoldingProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
func (p *NetboxBGPProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"endpoint": schema.StringAttribute{
Expand All @@ -48,8 +46,8 @@ func (p *ScaffoldingProvider) Schema(ctx context.Context, req provider.SchemaReq
}
}

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

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

Expand All @@ -66,27 +64,21 @@ 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 *NetboxBGPProvider) Resources(ctx context.Context) []func() resource.Resource {
return []func() resource.Resource{
NewExampleResource,
}
}

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

func (p *ScaffoldingProvider) 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 &NetboxBGPProvider{
version: version,
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// CLI command executed to create a provider server to which the CLI can
// reattach.
var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
"scaffolding": providerserver.NewProtocol6WithError(New("test")()),
"netboxbgp": providerserver.NewProtocol6WithError(New("test")()),
}

func testAccPreCheck(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"flag"
"log"

"github.com/ffddorf/terraform-provider-netbox-bgp/internal/provider"
"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/hashicorp/terraform-provider-scaffolding-framework/internal/provider"
)

// Run "go generate" to format example terraform files and generate the docs for the registry/website
Expand All @@ -20,7 +20,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 netboxbgp

var (
// these will be set by the goreleaser configuration
Expand All @@ -41,7 +41,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/ffddorf/netboxbgp",
Debug: debug,
}

Expand Down

0 comments on commit 4175e4a

Please sign in to comment.