diff --git a/internal/terraform/context_validate_test.go b/internal/terraform/context_validate_test.go index 61de7baccf22..3f611cdc8f3b 100644 --- a/internal/terraform/context_validate_test.go +++ b/internal/terraform/context_validate_test.go @@ -3259,6 +3259,16 @@ output "old" { output "new" { value = "new" } +`, + "mod3/main.tf": ` +output "old" { + deprecated = "mod2: Please stop using this" + value = "old" +} + +output "new" { + value = "new" +} `, "main.tf": ` module "mod" { @@ -3277,6 +3287,15 @@ module "mod2" { output "test_output2" { value = module.mod2[0].old # This should trigger a warning } + +module "mod3" { + count = 2 + source = "./mod3" +} + +output "test_output_no_warning" { + value = module.mod3[0].new +} `, }) @@ -3328,7 +3347,8 @@ output "test_output2" { Summary: "Usage of deprecated output", Detail: "mod/nested: Please stop using this", Subject: &hcl.Range{ - Filename: filepath.Join(m.Module.SourceDir, "mod", "main.tf"), + // TODO: investigate what is going on with the file path + Filename: filepath.Join("/private", m.Module.SourceDir, "mod", "main.tf"), Start: hcl.Pos{Line: 12, Column: 13, Byte: 159}, End: hcl.Pos{Line: 12, Column: 33, Byte: 179}, },