File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,38 @@ func Test_TerraformJSONSyntaxRule(t *testing.T) {
108108 }
109109 }
110110}
111+ ` ,
112+ },
113+ {
114+ name : "array with multiple resources of same type" ,
115+ content : `[
116+ {"resource": {"aws_instance": {"foo": {"ami": "ami-11111111"}}}},
117+ {"resource": {"aws_instance": {"bar": {"ami": "ami-22222222"}}}}
118+ ]` ,
119+ filename : "multi.tf.json" ,
120+ expected : helper.Issues {
121+ {
122+ Rule : NewTerraformJSONSyntaxRule (),
123+ Message : "JSON configuration uses array syntax at root, expected object" ,
124+ Range : hcl.Range {
125+ Filename : "multi.tf.json" ,
126+ Start : hcl.Pos {Line : 1 , Column : 1 },
127+ End : hcl.Pos {Line : 1 , Column : 2 },
128+ },
129+ },
130+ },
131+ fixed : `{
132+ "resource": {
133+ "aws_instance": {
134+ "bar": {
135+ "ami": "ami-22222222"
136+ },
137+ "foo": {
138+ "ami": "ami-11111111"
139+ }
140+ }
141+ }
142+ }
111143` ,
112144 },
113145 } {
You can’t perform that action at this time.
0 commit comments