From b31352c528ffc01828e7a36cdef5e4ccfc1fdf42 Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Mon, 4 Nov 2024 09:48:15 -0600 Subject: [PATCH] remove providermeta patch --- patches/0003-remove-provider-meta.patch | 158 ------------------------ 1 file changed, 158 deletions(-) delete mode 100644 patches/0003-remove-provider-meta.patch diff --git a/patches/0003-remove-provider-meta.patch b/patches/0003-remove-provider-meta.patch deleted file mode 100644 index 72d5c98fb..000000000 --- a/patches/0003-remove-provider-meta.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Oscar Cobles -Date: Thu, 4 Jul 2024 12:29:16 +0200 -Subject: [PATCH] remove provider meta - -Signed-off-by: Oscar Cobles - -diff --git a/equinix/provider.go b/equinix/provider.go -index fe8b02d..71772a9 100644 ---- a/equinix/provider.go -+++ b/equinix/provider.go -@@ -153,12 +153,6 @@ func Provider() *schema.Provider { - "equinix_metal_bgp_session": resourceMetalBGPSession(), - "equinix_metal_port_vlan_attachment": resourceMetalPortVlanAttachment(), - }, -- ProviderMetaSchema: map[string]*schema.Schema{ -- "module_name": { -- Type: schema.TypeString, -- Optional: true, -- }, -- }, - } - - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { -@@ -167,10 +161,6 @@ func Provider() *schema.Provider { - return provider - } - --type providerMeta struct { -- ModuleName string `cty:"module_name"` --} -- - func configureProvider(ctx context.Context, d *schema.ResourceData, p *schema.Provider) (interface{}, diag.Diagnostics) { - mrws := d.Get("max_retry_wait_seconds").(int) - rt := d.Get("request_timeout").(int) -@@ -186,11 +176,7 @@ func configureProvider(ctx context.Context, d *schema.ResourceData, p *schema.Pr - MaxRetries: d.Get("max_retries").(int), - MaxRetryWait: time.Duration(mrws) * time.Second, - } -- meta := providerMeta{} - -- if err := d.GetProviderMeta(&meta); err != nil { -- return nil, diag.FromErr(err) -- } - config.TerraformVersion = p.TerraformVersion - if config.TerraformVersion == "" { - // Terraform 0.12 introduced this field to the protocol -diff --git a/internal/config/config.go b/internal/config/config.go -index 2a491de..9800f9d 100644 ---- a/internal/config/config.go -+++ b/internal/config/config.go -@@ -34,10 +34,6 @@ const ( - MetalAuthTokenEnvVar = "METAL_AUTH_TOKEN" - ) - --type ProviderMeta struct { -- ModuleName string `cty:"module_name"` --} -- - const ( - consumerToken = "aZ9GmqHTPtxevvFq9SK3Pi2yr9YCbRzduCSXF2SNem5sjB91mDq7Th3ZwTtRqMWZ" - metalBasePath = "/metal/v1/" -@@ -278,16 +274,7 @@ func (c *Config) AddFwModuleToMetalUserAgent(ctx context.Context, meta tfsdk.Con - c.Metal.UserAgent = generateFwModuleUserAgentString(ctx, meta, c.metalUserAgent) - } - --func generateFwModuleUserAgentString(ctx context.Context, meta tfsdk.Config, baseUserAgent string) string { -- var m ProviderMeta -- diags := meta.Get(ctx, &m) -- if diags.HasError() { -- log.Printf("[WARN] error retrieving provider_meta") -- return baseUserAgent -- } -- if m.ModuleName != "" { -- return strings.Join([]string{m.ModuleName, baseUserAgent}, " ") -- } -+func generateFwModuleUserAgentString(_ context.Context, _ tfsdk.Config, baseUserAgent string) string { - return baseUserAgent - } - -@@ -295,24 +282,14 @@ func (c *Config) AddModuleToMetalUserAgent(d *schema.ResourceData) { - c.Metal.UserAgent = generateModuleUserAgentString(d, c.metalUserAgent) - } - --func generateModuleUserAgentString(d *schema.ResourceData, baseUserAgent string) string { -- var m ProviderMeta -- err := d.GetProviderMeta(&m) -- if err != nil { -- log.Printf("[WARN] error retrieving provider_meta") -- return baseUserAgent -- } -- -- if m.ModuleName != "" { -- return strings.Join([]string{m.ModuleName, baseUserAgent}, " ") -- } -+func generateModuleUserAgentString(_ *schema.ResourceData, baseUserAgent string) string { - return baseUserAgent - } - - func (c *Config) tfSdkUserAgent(suffix string) string { - sdkModulePath := "github.com/pulumi/pulumi/pkg/v3" - baseUserAgent := fmt.Sprintf("Pulumi/%s (+https://www.pulumi.com) Pulumi Plugin SDK/%s", -- c.TerraformVersion, moduleVersionFromBuild(sdkModulePath)) -+ c.TerraformVersion, moduleVersionFromBuild(sdkModulePath)) - baseUserAgent = appendUserAgentFromEnv(baseUserAgent) - userAgent := fmt.Sprintf("%s pulumi-equinix/%s %s", baseUserAgent, version.ProviderVersion, suffix) - return strings.TrimSpace(userAgent) -@@ -321,7 +298,7 @@ func (c *Config) tfSdkUserAgent(suffix string) string { - func (c *Config) tfFrameworkUserAgent(suffix string) string { - frameworkModulePath := "github.com/pulumi/pulumi/pkg/v3" - baseUserAgent := fmt.Sprintf("Pulumi/%s (+https://www.pulumi.com) Pulumi Plugin SDK/%s", -- c.TerraformVersion, moduleVersionFromBuild(frameworkModulePath)) -+ c.TerraformVersion, moduleVersionFromBuild(frameworkModulePath)) - baseUserAgent = appendUserAgentFromEnv(baseUserAgent) - userAgent := fmt.Sprintf("%s pulumi-equinix/%s %s", baseUserAgent, version.ProviderVersion, suffix) - return strings.TrimSpace(userAgent) -diff --git a/internal/provider/provider.go b/internal/provider/provider.go -index 4e0d186..cd2574b 100644 ---- a/internal/provider/provider.go -+++ b/internal/provider/provider.go -@@ -17,7 +17,6 @@ import ( - "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/provider" -- "github.com/hashicorp/terraform-plugin-framework/provider/metaschema" - "github.com/hashicorp/terraform-plugin-framework/provider/schema" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" -@@ -28,7 +27,7 @@ type FrameworkProvider struct { - Meta *config.Config - } - --func CreateFrameworkProvider(version string) provider.ProviderWithMetaSchema { -+func CreateFrameworkProvider(version string) provider.Provider { - return &FrameworkProvider{ - ProviderVersion: version, - } -@@ -98,20 +97,6 @@ func (p *FrameworkProvider) Schema( - } - } - --func (p *FrameworkProvider) MetaSchema( -- ctx context.Context, -- req provider.MetaSchemaRequest, -- resp *provider.MetaSchemaResponse, --) { -- resp.Schema = metaschema.Schema{ -- Attributes: map[string]metaschema.Attribute{ -- "module_name": schema.StringAttribute{ -- Optional: true, -- }, -- }, -- } --} -- - func (p *FrameworkProvider) Resources(ctx context.Context) []func() resource.Resource { - return []func() resource.Resource{ - metalgateway.NewResource,