mirror of
https://github.com/hashicorp/terraform.git
synced 2026-02-03 20:50:59 -05:00
move test case to more appropriate PR
https://github.com/hashicorp/terraform/pull/38006 is dealing with resource deprecation
This commit is contained in:
parent
5b40f274b2
commit
0a9bfcc8d0
1 changed files with 0 additions and 58 deletions
|
|
@ -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": `
|
||||
|
|
|
|||
Loading…
Reference in a new issue