From e18fdaa851f786dad3eeea2ad55ec3a6cd29bdfb Mon Sep 17 00:00:00 2001 From: Dana Fallon <8871189+danafallon@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:49:13 -0700 Subject: [PATCH 1/4] Rename provider --- internal/provider/provider.go | 26 +++++++++++++------------- main.go | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 2471df6..9be0306 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -15,12 +15,12 @@ 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. @@ -32,12 +32,12 @@ type ScaffoldingProviderModel 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{ @@ -48,7 +48,7 @@ func (p *ScaffoldingProvider) Schema(ctx context.Context, req provider.SchemaReq } } -func (p *ScaffoldingProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { +func (p *ArtieProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { var data ScaffoldingProviderModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) @@ -66,19 +66,19 @@ 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, } @@ -86,7 +86,7 @@ func (p *ScaffoldingProvider) Functions(ctx context.Context) []func() function.F func New(version string) func() provider.Provider { return func() provider.Provider { - return &ScaffoldingProvider{ + return &ArtieProvider{ version: version, } } diff --git a/main.go b/main.go index f9c34b4..4bc9fe5 100644 --- a/main.go +++ b/main.go @@ -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 @@ -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, } From e25d663f7ec631c8fcf228f51b9c254c3ca0ede8 Mon Sep 17 00:00:00 2001 From: Dana Fallon <8871189+danafallon@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:51:59 -0700 Subject: [PATCH 2/4] Generate docs --- docs/data-sources/example.md | 10 ++-------- docs/functions/example.md | 26 -------------------------- docs/index.md | 4 ++-- docs/resources/example.md | 10 ++-------- internal/provider/provider.go | 6 +++--- internal/provider/provider_test.go | 2 +- 6 files changed, 10 insertions(+), 48 deletions(-) delete mode 100644 docs/functions/example.md diff --git a/docs/data-sources/example.md b/docs/data-sources/example.md index b19c8a0..ec1fd54 100644 --- a/docs/data-sources/example.md +++ b/docs/data-sources/example.md @@ -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 diff --git a/docs/functions/example.md b/docs/functions/example.md deleted file mode 100644 index c65087d..0000000 --- a/docs/functions/example.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "example function - scaffolding" -subcategory: "" -description: |- - Example function ---- - -# function: example - -Echoes given argument as result - - - -## Signature - - -```text -example(input string) string -``` - -## Arguments - - -1. `input` (String) String to echo - diff --git a/docs/index.md b/docs/index.md index 7458d6d..66250c5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,12 +1,12 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding Provider" +page_title: "artie Provider" subcategory: "" description: |- --- -# scaffolding Provider +# artie Provider diff --git a/docs/resources/example.md b/docs/resources/example.md index 5f3d5ca..07f4cbe 100644 --- a/docs/resources/example.md +++ b/docs/resources/example.md @@ -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 diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 9be0306..17aaeef 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -27,8 +27,8 @@ type ArtieProvider struct { 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"` } @@ -49,7 +49,7 @@ func (p *ArtieProvider) Schema(ctx context.Context, req provider.SchemaRequest, } func (p *ArtieProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { - var data ScaffoldingProviderModel + var data ArtieProviderModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index ef6599b..2fa09c1 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -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) { From 8a1a1295435f83984688e2bc40e10615c74d2786 Mon Sep 17 00:00:00 2001 From: Dana Fallon <8871189+danafallon@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:54:13 -0700 Subject: [PATCH 3/4] Rename more --- .../data-sources/scaffolding_example/data-source.tf | 2 +- examples/provider/provider.tf | 2 +- examples/resources/scaffolding_example/resource.tf | 2 +- internal/provider/example_data_source_test.go | 4 ++-- internal/provider/example_function_test.go | 6 +++--- internal/provider/example_resource_test.go | 12 ++++++------ 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/data-sources/scaffolding_example/data-source.tf b/examples/data-sources/scaffolding_example/data-source.tf index a852489..d6acf5d 100644 --- a/examples/data-sources/scaffolding_example/data-source.tf +++ b/examples/data-sources/scaffolding_example/data-source.tf @@ -1,3 +1,3 @@ -data "scaffolding_example" "example" { +data "artie_example" "example" { configurable_attribute = "some-value" } diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 942db45..ce0b9ab 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,3 +1,3 @@ -provider "scaffolding" { +provider "artie" { # example configuration here } diff --git a/examples/resources/scaffolding_example/resource.tf b/examples/resources/scaffolding_example/resource.tf index 9ae3f57..926bfa5 100644 --- a/examples/resources/scaffolding_example/resource.tf +++ b/examples/resources/scaffolding_example/resource.tf @@ -1,3 +1,3 @@ -resource "scaffolding_example" "example" { +resource "artie_example" "example" { configurable_attribute = "some-value" } diff --git a/internal/provider/example_data_source_test.go b/internal/provider/example_data_source_test.go index 6f9aa7d..deebb1f 100644 --- a/internal/provider/example_data_source_test.go +++ b/internal/provider/example_data_source_test.go @@ -18,7 +18,7 @@ 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"), ), }, }, @@ -26,7 +26,7 @@ func TestAccExampleDataSource(t *testing.T) { } const testAccExampleDataSourceConfig = ` -data "scaffolding_example" "test" { +data "artie_example" "test" { configurable_attribute = "example" } ` diff --git a/internal/provider/example_function_test.go b/internal/provider/example_function_test.go index f7b5bdd..ceb8d30 100644 --- a/internal/provider/example_function_test.go +++ b/internal/provider/example_function_test.go @@ -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( @@ -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 @@ -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( diff --git a/internal/provider/example_resource_test.go b/internal/provider/example_resource_test.go index c5464d0..b18a087 100644 --- a/internal/provider/example_resource_test.go +++ b/internal/provider/example_resource_test.go @@ -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 @@ -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 @@ -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) From 94ebb0c93697352be38d70c6092e163a16a2fc11 Mon Sep 17 00:00:00 2001 From: Dana Fallon <8871189+danafallon@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:57:29 -0700 Subject: [PATCH 4/4] Generate docs again --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 66250c5..f938291 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,7 +13,7 @@ description: |- ## Example Usage ```terraform -provider "scaffolding" { +provider "artie" { # example configuration here } ```