From 0a9bfcc8d092d868c98967d1b6a8343bbdacaeb8 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Mon, 12 Jan 2026 15:42:57 +0100 Subject: [PATCH] move test case to more appropriate PR https://github.com/hashicorp/terraform/pull/38006 is dealing with resource deprecation --- internal/terraform/context_validate_test.go | 58 --------------------- 1 file changed, 58 deletions(-) diff --git a/internal/terraform/context_validate_test.go b/internal/terraform/context_validate_test.go index aaeada1f70..dc4d0725cd 100644 --- a/internal/terraform/context_validate_test.go +++ b/internal/terraform/context_validate_test.go @@ -4412,64 +4412,6 @@ module "sink" { })) } -// TODO: Shouldn't this one live in https://github.com/hashicorp/terraform/pull/38006 -func TestContext2Validate_deprecated_resource(t *testing.T) { - m := testModuleInline(t, map[string]string{ - "main.tf": ` -resource "test_resource" "test" { # WARNING - attr = "value" -} - -output "a" { - value = test_resource.test.attr # WARNING -} -`, - }) - - p := new(testing_provider.MockProvider) - p.GetProviderSchemaResponse = getProviderSchemaResponseFromProviderSchema(&providerSchema{ - ResourceTypes: map[string]*configschema.Block{ - "test_resource": { - Deprecated: true, - Attributes: map[string]*configschema.Attribute{ - "attr": { - Type: cty.String, - Computed: true, - }, - }, - }, - }, - }) - - ctx := testContext2(t, &ContextOpts{ - Providers: map[addrs.Provider]providers.Factory{ - addrs.NewDefaultProvider("test"): testProviderFuncFixed(p), - }, - }) - - diags := ctx.Validate(m, &ValidateOpts{}) - - tfdiags.AssertDiagnosticsMatch(t, diags, tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: `Usage of deprecated resource "test_resource"`, - Detail: `The resource "test_resource" has been marked as deprecated by its provider. Please check the provider documentation for more information.`, - Subject: &hcl.Range{ - Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 2, Column: 1, Byte: 1}, - End: hcl.Pos{Line: 2, Column: 32, Byte: 32}, - }, - }).Append(&hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Deprecated value used", - Detail: `Resource "test_resource" is deprecated`, - Subject: &hcl.Range{ - Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 7, Column: 13, Byte: 92}, - End: hcl.Pos{Line: 7, Column: 36, Byte: 115}, - }, - })) -} - func TestContext2Validate_deprecated_root_output(t *testing.T) { m := testModuleInline(t, map[string]string{ "mod/main.tf": `