Skip to content

Commit 81d1f79

Browse files
committed
add test for quoted keys
1 parent a2e8d25 commit 81d1f79

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

rules/terraform_map_duplicate_keys_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,27 @@ resource "null_resource" "test" {
4747
},
4848
},
4949
},
50+
{
51+
Name: "duplicate keys with quoting",
52+
Content: `
53+
resource "null_resource" "test" {
54+
triggers = {
55+
a = "b"
56+
"a" = "c"
57+
}
58+
}`,
59+
Expected: helper.Issues{
60+
{
61+
Rule: NewTerraformMapDuplicateKeysRule(),
62+
Message: `Duplicate key: "a", first defined at module.tf:4,9-10`,
63+
Range: hcl.Range{
64+
Filename: "module.tf",
65+
Start: hcl.Pos{Line: 5, Column: 9},
66+
End: hcl.Pos{Line: 5, Column: 12},
67+
},
68+
},
69+
},
70+
},
5071
{
5172
Name: "Using variables as keys",
5273
Content: `

0 commit comments

Comments
 (0)