diff --git a/decoder/body_extensions_test.go b/decoder/body_extensions_test.go index 0ed1e2f6..3e56566c 100644 --- a/decoder/body_extensions_test.go +++ b/decoder/body_extensions_test.go @@ -2137,6 +2137,50 @@ resource "aws_elastic_beanstalk_environment" "example" { }, }), }, + { + "dynamic block label never completes static blocks", + &schema.BodySchema{ + Blocks: map[string]*schema.BlockSchema{ + "resource": { + Labels: []*schema.LabelSchema{ + { + Name: "type", + IsDepKey: true, + Completable: true, + }, + {Name: "name"}, + }, + Body: &schema.BodySchema{ + Extensions: &schema.BodyExtensions{ + DynamicBlocks: true, + }, + Blocks: map[string]*schema.BlockSchema{ + "lifecycle": { + Body: schema.NewBodySchema(), + }, + }, + }, + DependentBody: map[schema.SchemaKey]*schema.BodySchema{ + schema.NewSchemaKey(schema.DependencyKeys{ + Labels: []schema.LabelDependent{ + {Index: 0, Value: "aws_instance"}, + }, + }): { + Blocks: make(map[string]*schema.BlockSchema, 0), + }, + }, + }, + }, + }, + `resource "aws_instance" "example" { + name = "example" + dynamic "" { + + } +}`, + hcl.Pos{Line: 3, Column: 12, Byte: 66}, + lang.CompleteCandidates([]lang.Candidate{}), + }, // completion nesting should work { "dynamic block completion nesting should work",