From 2b7c78ebfa3d46b62c027c0332b1b891fe7683eb Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Mon, 29 Jul 2024 12:17:31 +1000 Subject: [PATCH] prefer utility over custom for typename --- octopusdeploy_framework/datasource_environments.go | 2 +- octopusdeploy_framework/datasource_feeds.go | 2 +- octopusdeploy_framework/datasource_project_groups.go | 2 +- octopusdeploy_framework/resource_artifactory_generic_feed.go | 3 ++- .../resource_aws_elastic_container_registry.go | 3 ++- octopusdeploy_framework/resource_environment.go | 2 +- octopusdeploy_framework/resource_github_repository_feed.go | 3 ++- octopusdeploy_framework/resource_helm_feed.go | 3 ++- octopusdeploy_framework/resource_maven_feed.go | 3 ++- octopusdeploy_framework/resource_nuget_feed.go | 3 ++- octopusdeploy_framework/resource_project_group.go | 3 ++- 11 files changed, 18 insertions(+), 11 deletions(-) diff --git a/octopusdeploy_framework/datasource_environments.go b/octopusdeploy_framework/datasource_environments.go index f86545c62..b788107d5 100644 --- a/octopusdeploy_framework/datasource_environments.go +++ b/octopusdeploy_framework/datasource_environments.go @@ -36,7 +36,7 @@ func NewEnvironmentsDataSource() datasource.DataSource { } func (*environmentDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_environments" + resp.TypeName = util.GetTypeName("environments") } func (*environmentDataSource) Schema(_ context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { diff --git a/octopusdeploy_framework/datasource_feeds.go b/octopusdeploy_framework/datasource_feeds.go index ddc7be138..d8c19a863 100644 --- a/octopusdeploy_framework/datasource_feeds.go +++ b/octopusdeploy_framework/datasource_feeds.go @@ -23,7 +23,7 @@ func NewFeedsDataSource() datasource.DataSource { } func (*feedsDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_feeds" + resp.TypeName = util.GetTypeName("feeds") } func (e *feedsDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { diff --git a/octopusdeploy_framework/datasource_project_groups.go b/octopusdeploy_framework/datasource_project_groups.go index be54058b6..01713abbc 100644 --- a/octopusdeploy_framework/datasource_project_groups.go +++ b/octopusdeploy_framework/datasource_project_groups.go @@ -42,7 +42,7 @@ func getNestedGroupAttributes() map[string]attr.Type { } func (p *projectGroupsDataSource) Metadata(_ context.Context, _ datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_project_groups" + resp.TypeName = util.GetTypeName("project_groups") } func (p *projectGroupsDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_artifactory_generic_feed.go b/octopusdeploy_framework/resource_artifactory_generic_feed.go index 24074bd5c..e70900061 100644 --- a/octopusdeploy_framework/resource_artifactory_generic_feed.go +++ b/octopusdeploy_framework/resource_artifactory_generic_feed.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/schemas" + "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -23,7 +24,7 @@ func NewArtifactoryGenericFeedResource() resource.Resource { } func (r *artifactoryGenericFeedTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_artifactory_generic_feed" + resp.TypeName = util.GetTypeName("artifactory_generic_feed") } func (r *artifactoryGenericFeedTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_aws_elastic_container_registry.go b/octopusdeploy_framework/resource_aws_elastic_container_registry.go index 6c3f602a4..96f089a83 100644 --- a/octopusdeploy_framework/resource_aws_elastic_container_registry.go +++ b/octopusdeploy_framework/resource_aws_elastic_container_registry.go @@ -6,6 +6,7 @@ import ( "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/feeds" "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/schemas" + "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -22,7 +23,7 @@ func NewAwsElasticContainerRegistryFeedResource() resource.Resource { } func (r *awsElasticContainerRegistryFeedTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_aws_elastic_container_registry" + resp.TypeName = util.GetTypeName("aws_elastic_container_registry") } func (r *awsElasticContainerRegistryFeedTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_environment.go b/octopusdeploy_framework/resource_environment.go index 87451ece3..a393279ad 100644 --- a/octopusdeploy_framework/resource_environment.go +++ b/octopusdeploy_framework/resource_environment.go @@ -20,7 +20,7 @@ func NewEnvironmentResource() resource.Resource { } func (r *environmentTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_environment" + resp.TypeName = util.GetTypeName("environment") } func (r *environmentTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_github_repository_feed.go b/octopusdeploy_framework/resource_github_repository_feed.go index 13fefa853..7a198daaa 100644 --- a/octopusdeploy_framework/resource_github_repository_feed.go +++ b/octopusdeploy_framework/resource_github_repository_feed.go @@ -6,6 +6,7 @@ import ( "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/feeds" "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/schemas" + "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -22,7 +23,7 @@ func NewGitHubRepositoryFeedResource() resource.Resource { } func (r *githubRepositoryFeedTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_github_repository_feed" + resp.TypeName = util.GetTypeName("github_repository_feed") } func (r *githubRepositoryFeedTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_helm_feed.go b/octopusdeploy_framework/resource_helm_feed.go index ced350894..4fc1c9d3c 100644 --- a/octopusdeploy_framework/resource_helm_feed.go +++ b/octopusdeploy_framework/resource_helm_feed.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/schemas" + "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -23,7 +24,7 @@ func NewHelmFeedResource() resource.Resource { } func (r *helmFeedTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_helm_feed" + resp.TypeName = util.GetTypeName("helm_feed") } func (r *helmFeedTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_maven_feed.go b/octopusdeploy_framework/resource_maven_feed.go index c7a1394c8..c6f6ddd19 100644 --- a/octopusdeploy_framework/resource_maven_feed.go +++ b/octopusdeploy_framework/resource_maven_feed.go @@ -6,6 +6,7 @@ import ( "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/feeds" "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/schemas" + "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -22,7 +23,7 @@ func NewMavenFeedResource() resource.Resource { } func (r *mavenFeedTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_maven_feed" + resp.TypeName = util.GetTypeName("maven_feed") } func (r *mavenFeedTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_nuget_feed.go b/octopusdeploy_framework/resource_nuget_feed.go index dc1e304d6..306e16f14 100644 --- a/octopusdeploy_framework/resource_nuget_feed.go +++ b/octopusdeploy_framework/resource_nuget_feed.go @@ -6,6 +6,7 @@ import ( "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/feeds" "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/schemas" + "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -22,7 +23,7 @@ func NewNugetFeedResource() resource.Resource { } func (r *nugetFeedTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_nuget_feed" + resp.TypeName = util.GetTypeName("nuget_feed") } func (r *nugetFeedTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { diff --git a/octopusdeploy_framework/resource_project_group.go b/octopusdeploy_framework/resource_project_group.go index 994b38702..e78f49cef 100644 --- a/octopusdeploy_framework/resource_project_group.go +++ b/octopusdeploy_framework/resource_project_group.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/projectgroups" "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/schemas" + "github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -20,7 +21,7 @@ func NewProjectGroupResource() resource.Resource { } func (r *projectGroupTypeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = ProviderTypeName + "_project_group" + resp.TypeName = util.GetTypeName("project_group") } func (r *projectGroupTypeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {