outline.scm

 1; HCL Outline Scheme
 2; Comments
 3(comment) @annotation
 4
 5; Block with and without string_lit
 6; Example:
 7;   terraform { ... }
 8;   module "vpc" { ... }
 9;   resource "resource" "name" { ... }
10(config_file
11    (body
12        (block
13            (identifier) @context
14            (string_lit)? @name
15            (string_lit)? @name
16        ) @item
17    )
18)
19
20; Inside block with identifier
21(config_file
22    (body
23        (block
24            (identifier)
25            (body
26                (attribute
27                    (identifier) @context
28                ) @item
29            )
30        )
31    )
32)
33
34; Inside block with identifier and string_lit
35(config_file
36  (body
37    (block
38      (identifier)
39      (body
40        (block
41            (identifier) @context
42            (string_lit)? @name
43        ) @item
44      )
45    )
46  )
47)
48
49; Root Attribute block
50; Example:
51; inputs = { ... }
52(config_file
53  (body
54    (attribute
55      (identifier) @context
56    ) @item
57  )
58)
59
60; Inside Root Attribute block
61(config_file
62  (body
63    (attribute
64      (identifier)
65        (expression
66          (collection_value
67            (object
68              (object_elem
69                key: (expression (variable_expr (identifier) @context))
70              ) @item
71            )
72          )
73        )
74    )
75  )
76)