Skip to content

Commit

Permalink
Merge pull request #1 from artie-labs/dana/rename
Browse files Browse the repository at this point in the history
Rename provider
  • Loading branch information
danafallon authored Jul 22, 2024
2 parents f2633b9 + 94ebb0c commit 50edda0
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 78 deletions.
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: "artie_example Data Source - artie"
subcategory: ""
description: |-
Example data source
---

# scaffolding_example (Data Source)
# artie_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: "artie Provider"
subcategory: ""
description: |-
---

# scaffolding Provider
# artie Provider



## Example Usage

```terraform
provider "scaffolding" {
provider "artie" {
# 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: "artie_example Resource - artie"
subcategory: ""
description: |-
Example resource
---

# scaffolding_example (Resource)
# artie_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/data-sources/scaffolding_example/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "scaffolding_example" "example" {
data "artie_example" "example" {
configurable_attribute = "some-value"
}
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 "artie" {
# example configuration here
}
2 changes: 1 addition & 1 deletion examples/resources/scaffolding_example/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
resource "scaffolding_example" "example" {
resource "artie_example" "example" {
configurable_attribute = "some-value"
}
4 changes: 2 additions & 2 deletions internal/provider/example_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ func TestAccExampleDataSource(t *testing.T) {
{
Config: testAccExampleDataSourceConfig,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.scaffolding_example.test", "id", "example-id"),
resource.TestCheckResourceAttr("data.artie_example.test", "id", "example-id"),
),
},
},
})
}

const testAccExampleDataSourceConfig = `
data "scaffolding_example" "test" {
data "artie_example" "test" {
configurable_attribute = "example"
}
`
6 changes: 3 additions & 3 deletions internal/provider/example_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestExampleFunction_Known(t *testing.T) {
{
Config: `
output "test" {
value = provider::scaffolding::example("testvalue")
value = provider::artie::example("testvalue")
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -42,7 +42,7 @@ func TestExampleFunction_Null(t *testing.T) {
{
Config: `
output "test" {
value = provider::scaffolding::example(null)
value = provider::artie::example(null)
}
`,
// The parameter does not enable AllowNullValue
Expand All @@ -66,7 +66,7 @@ func TestExampleFunction_Unknown(t *testing.T) {
}
output "test" {
value = provider::scaffolding::example(terraform_data.test.output)
value = provider::artie::example(terraform_data.test.output)
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/example_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ func TestAccExampleResource(t *testing.T) {
{
Config: testAccExampleResourceConfig("one"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "one"),
resource.TestCheckResourceAttr("scaffolding_example.test", "defaulted", "example value when not configured"),
resource.TestCheckResourceAttr("scaffolding_example.test", "id", "example-id"),
resource.TestCheckResourceAttr("artie_example.test", "configurable_attribute", "one"),
resource.TestCheckResourceAttr("artie_example.test", "defaulted", "example value when not configured"),
resource.TestCheckResourceAttr("artie_example.test", "id", "example-id"),
),
},
// ImportState testing
{
ResourceName: "scaffolding_example.test",
ResourceName: "artie_example.test",
ImportState: true,
ImportStateVerify: true,
// This is not normally necessary, but is here because this
Expand All @@ -39,7 +39,7 @@ func TestAccExampleResource(t *testing.T) {
{
Config: testAccExampleResourceConfig("two"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "two"),
resource.TestCheckResourceAttr("artie_example.test", "configurable_attribute", "two"),
),
},
// Delete testing automatically occurs in TestCase
Expand All @@ -49,7 +49,7 @@ func TestAccExampleResource(t *testing.T) {

func testAccExampleResourceConfig(configurableAttribute string) string {
return fmt.Sprintf(`
resource "scaffolding_example" "test" {
resource "artie_example" "test" {
configurable_attribute = %[1]q
}
`, configurableAttribute)
Expand Down
32 changes: 16 additions & 16 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types"
)

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

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

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

func (p *ScaffoldingProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
func (p *ArtieProvider) 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 +48,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 *ArtieProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
var data ArtieProviderModel

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

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

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

func (p *ScaffoldingProvider) Functions(ctx context.Context) []func() function.Function {
func (p *ArtieProvider) 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 &ArtieProvider{
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")()),
"artie": providerserver.NewProtocol6WithError(New("test")()),
}

func testAccPreCheck(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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 artie

var (
// these will be set by the goreleaser configuration
Expand All @@ -42,7 +42,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: "artie.com/terraform/artie",
Debug: debug,
}

Expand Down

0 comments on commit 50edda0

Please sign in to comment.