tf query: disable depends_on for list blocks (#37618)

pull/37616/head
Samsondeen 8 months ago committed by GitHub
parent 0b15151513
commit 1048510fec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -197,6 +197,15 @@ func TestParserLoadConfigDirWithQueries(t *testing.T) {
},
allowExperiments: true,
},
{
name: "with-depends-on",
directory: "testdata/query-files/invalid/with-depends-on",
diagnostics: []string{
"testdata/query-files/invalid/with-depends-on/main.tfquery.hcl:23,3-13: Unsupported argument; An argument named \"depends_on\" is not expected here.",
},
listResources: 2,
allowExperiments: true,
},
}
for _, test := range tests {

@ -194,15 +194,23 @@ func decodeQueryListBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
// QueryListResourceBlockSchema is the schema for a list resource type within
// a terraform query file.
var QueryListResourceBlockSchema = &hcl.BodySchema{
Attributes: append(
commonResourceAttributes,
hcl.AttributeSchema{
Attributes: []hcl.AttributeSchema{
{
Name: "count",
},
{
Name: "for_each",
},
{
Name: "provider",
},
{
Name: "include_resource",
},
hcl.AttributeSchema{
{
Name: "limit",
},
),
},
}
// queryFileSchema is the schema for a terraform query file. It defines the

@ -0,0 +1,24 @@
list "aws_instance" "test" {
provider = aws
count = 1
include_resource = true
limit = 5
config {
tags = {
Name = "test"
}
}
}
list "aws_instance" "test2" {
provider = aws
count = 1
config {
tags = {
Name = join("-", ["test2", list.aws_instance.test.data[0]])
}
}
}
list "aws_instance" "test3" {
provider = aws
depends_on = [list.aws_instance.test2]
}
Loading…
Cancel
Save