diff --git a/Terraform.sublime-syntax b/Terraform.sublime-syntax index db43ed0..02ca3ea 100644 --- a/Terraform.sublime-syntax +++ b/Terraform.sublime-syntax @@ -29,7 +29,7 @@ variables: # Identifiers: (UTF-8) (ID_Continue | '-')*; # # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#identifiers - identifer: \b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\b + identifer: (?:\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\b) # Exponent: "e" or "E" followed by an optional sign # @@ -52,7 +52,7 @@ variables: # Terraform Named Values # # https://www.terraform.io/docs/language/expressions/references.html - named_values: var|local|module|data|path|terraform + named_values: var|local|module|data|path|terraform|each|count|self # Block types that are known to Terraform. # @@ -74,8 +74,38 @@ variables: # Built-In Functions # - # https://www.terraform.io/docs/language/functions/index.html - predeclared_funcs: abs|ceil|floor|log|max|min|pow|signum|chomp|format|formatlist|indent|join|lower|regex|regexall|replace|split|strrev|substr|title|trimspace|upper|chunklist|coalesce|coalescelist|compact|concat|contains|distinct|element|flatten|index|keys|length|list|lookup|map|matchkeys|merge|range|reverse|setintersection|setproduct|setunion|slice|sort|transpose|values|zipmap|base64decode|base64encode|base64gzip|csvdecode|jsondecode|jsonencode|urlencode|yamldecode|yamlencode|abspath|dirname|pathexpand|basename|file|fileexists|fileset|filebase64|templatefile|formatdate|timeadd|timestamp|base64sha256|base64sha512|bcrypt|filebase64sha256|filebase64sha512|filemd5|filemd1|filesha256|filesha512|md5|rsadecrypt|sha1|sha256|sha512|uuid|uuidv5|cidrhost|cidrnetmask|cidrsubnet|tobool|tolist|tomap|tonumber|toset|tostring + # https://developer.hashicorp.com/terraform/language/functions + predeclared_funcs: |- + \b(?x: + # numbers + abs|ceil|floor|log|max|min|parseint|pow|signum + # string + |chomp|endswith|format|formatlist|indent|join|lower|regex|regexall|replace + |split|startswith|strcontains|strrev|substr + |templatestring|title|trim|trimprefix|trimsuffix|trimspace|upper + # collection + |alltrue|anytrue|chunklist|coalesce|coalescelist|compact|concat|contains + |distinct|element|flatten|index|keys|length|list|lookup + |map|matchkeys|merge|one|range|reverse + |setintersection|setproduct|setsubtract|setunion|slice|sort|sum + |transpose|values|zipmap + # encoding + |base64decode|base64encode|base64gzip|csvdecode|jsondecode|jsonencode|textdecodebase64|textencodebase64|urlencode|yamldecode|yamlencode + # filesystem + |abspath|dirname|pathexpand|basename|file|fileexists|fileset|filebase64|templatefile + # date and time + |formatdate|plantimestamp|timeadd|timecmp|timestamp + # hash and crypto + |base64sha256|base64sha512|bcrypt|filebase64sha256|filebase64sha512|filemd5|filesha1|filesha256|filesha512|md5|rsadecrypt|sha1|sha256|sha512|uuid|uuidv5 + # ip network + |cidrhost|cidrnetmask|cidrsubnet|cidrsubnets + # type conversion + |can|issensitive|nonsensitive|sensitive|tobool|tolist|tomap|tonumber|toset|tostring|try|type + # terraform-specific + |provider::terraform::(?:encode_tfvars|decode_tfvars|encode_expr) + # deprecated/old + |filemd1 + )\b contexts: main: @@ -208,15 +238,17 @@ contexts: - match: '"' comment: Strings scope: punctuation.definition.string.begin.terraform - push: - - meta_scope: meta.string.terraform string.quoted.double.terraform - - match: '"' - scope: punctuation.definition.string.end.terraform - pop: true - - include: string_interpolation - - match: '{{char_escapes}}' - comment: Character Escapes - scope: constant.character.escape.terraform + push: string_body + + string_body: + - meta_scope: meta.string.terraform string.quoted.double.terraform + - match: '"' + scope: punctuation.definition.string.end.terraform + pop: true + - include: string_interpolation + - match: '{{char_escapes}}' + comment: Character Escapes + scope: constant.character.escape.terraform # String Interpolation: ("${" | "${~") Expression ("}" | "~}" # @@ -226,19 +258,21 @@ contexts: captures: 1: punctuation.section.interpolation.begin.terraform 2: keyword.operator.template.trim.left.terraform - push: - - meta_scope: meta.interpolation.terraform - - meta_content_scope: source.terraform - - clear_scopes: 1 # Clear the string.* scope. - - match: (~)?(\}) - captures: - 1: keyword.operator.template.trim.right.terraform - 2: punctuation.section.interpolation.end.terraform - pop: true - - match: \b(if|else|endif|for|in|endfor)\b - comment: if/else/endif and for/in/endfor directives - scope: keyword.control.terraform - - include: expressions + push: string_interpolation_body + + string_interpolation_body: + - meta_scope: meta.interpolation.terraform + - meta_content_scope: source.terraform + - clear_scopes: 1 # Clear the string.* scope. + - match: (~)?(\}) + captures: + 1: keyword.operator.template.trim.right.terraform + 2: punctuation.section.interpolation.end.terraform + pop: true + - match: \b(if|else|endif|for|in|endfor)\b + comment: if/else/endif and for/in/endfor directives + scope: keyword.control.terraform + - include: expressions # String Heredocs # @@ -353,43 +387,54 @@ contexts: objects: - match: \{ scope: punctuation.section.braces.begin.terraform + push: object_body + + object_body: + - meta_scope: meta.braces.terraform + - match: \} + scope: punctuation.section.braces.end.terraform + pop: true + - include: object_for_expression + - include: comments + - match: (?=({{identifer}}|\".*?\")\s*=) push: - - meta_scope: meta.braces.terraform - - match: \} - scope: punctuation.section.braces.end.terraform - pop: true - - include: object_for_expression - - include: comments - - match: '\s*({{identifer}})\s*(\=)\s*' - comment: Literal, named object key + - object_value + - assignment_operator + - object_key + - match: \( + comment: Computed object key (any expression between parens) + scope: punctuation.section.parens.begin.terraform + push: + - meta_scope: meta.mapping.key.terraform + - match: '(\))\s*(\=)\s*' captures: - 1: meta.mapping.key.terraform string.unquoted.terraform + 1: punctuation.section.parens.end.terraform 2: keyword.operator.terraform - push: object_key_values - - match: '((\").*(\"))\s*(\=)\s*' - comment: String object key - captures: - 1: meta.mapping.key.terraform string.quoted.double.terraform - 2: punctuation.definition.string.begin.terraform - 3: punctuation.definition.string.end.terraform - 4: keyword.operator.terraform - push: object_key_values - - match: \( - comment: Computed object key (any expression between parens) - scope: punctuation.section.parens.begin.terraform - push: - - meta_scope: meta.mapping.key.terraform - - match: '(\))\s*(\=)\s*' - captures: - 1: punctuation.section.parens.end.terraform - 2: keyword.operator.terraform - set: object_key_values - - include: expressions + set: object_value + - include: expressions + + object_key: + - match: '{{identifer}}' + scope: meta.mapping.key.terraform string.unquoted.terraform + pop: true + - match: (\").*?(\") + scope: meta.mapping.key.terraform string.quoted.double.terraform + captures: + 1: punctuation.definition.string.begin.terraform + 2: punctuation.definition.string.end.terraform + pop: true + - include: else_pop + + assignment_operator: + - match: = + scope: keyword.operator.assignment.terraform + pop: true + - include: else_pop # Object key values: pop at comma, newline, and closing-bracket # # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#collection-values - object_key_values: + object_value: - include: comments - include: expressions - match: \, @@ -431,26 +476,45 @@ contexts: # # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#attribute-definitions attribute_definition: - - match: (\()?({{identifer}})(\))?\s*(\=[^\=|\>])\s* - comment: Identifier "=" with optional parens - scope: variable.declaration.terraform - captures: - 1: punctuation.section.parens.begin.terraform - 2: variable.other.readwrite.terraform - 3: punctuation.section.parens.end.terraform - 4: keyword.operator.assignment.terraform + - match: (?=(\()?({{identifer}})(\))?\s*(\=(?![\=\>]))) + push: + - assignment_operator + - attribute_key + + attribute_key: + - match: \((?={{identifer}}\)) + scope: punctuation.section.parens.begin.terraform + set: + - attribute_key_end + - attribute_key + # https://developer.hashicorp.com/terraform/language/meta-arguments/for_each + - match: for_each\b + scope: variable.declaration.terraform keyword.control.loop.for.terraform + pop: true + # https://developer.hashicorp.com/terraform/language/meta-arguments/count + - match: count\b + scope: variable.declaration.terraform keyword.control.conditional.terraform + pop: true + - match: '{{identifer}}' + scope: variable.declaration.terraform variable.other.readwrite.terraform + pop: true + + attribute_key_end: + - match: \) + scope: punctuation.section.parens.end.terraform + pop: true # Functions: Terraform builtins and unknown # # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#functions-and-function-calls # https://www.terraform.io/docs/language/expressions/function-calls.html functions: - - match: (({{predeclared_funcs}})|\b({{identifer}})\b)(\() + - match: (?:({{predeclared_funcs}})|\b({{identifer}})\b)(\() comment: Built-in function calls captures: - 2: support.function.builtin.terraform - 3: variable.function.terraform - 4: punctuation.section.parens.begin.terraform + 1: support.function.builtin.terraform + 2: variable.function.terraform + 3: punctuation.section.parens.begin.terraform push: - meta_scope: meta.function-call.terraform - match: \) @@ -521,24 +585,32 @@ contexts: captures: 1: keyword.declaration.terraform 2: entity.name.type.terraform - push: - - meta_scope: meta.type.terraform - - match: \" - comment: String literal label - scope: punctuation.definition.string.begin.terraform - push: - - meta_scope: string.quoted.double.terraform - - match: \" - scope: punctuation.definition.string.end.terraform - pop: true - - match: "{{identifer}}" - comment: Identifer label - scope: entity.name.label.terraform - - match: \{ - scope: punctuation.section.block.begin.terraform - set: - - meta_scope: meta.block.terraform - - include: main - - match: \} - scope: punctuation.section.block.end.terraform - pop: true + push: block_name + + block_name: + - meta_scope: meta.type.terraform + - match: \" + scope: punctuation.definition.string.begin.terraform + push: block_name_body + - match: "{{identifer}}" + scope: entity.name.label.terraform + - match: \{ + scope: punctuation.section.block.begin.terraform + set: block_body + + block_name_body: + - meta_scope: string.quoted.double.terraform + - match: \" + scope: punctuation.definition.string.end.terraform + pop: true + + block_body: + - meta_scope: meta.block.terraform + - include: main + - match: \} + scope: punctuation.section.block.end.terraform + pop: true + + else_pop: + - match: (?=\S) + pop: true diff --git a/syntax_test_terraform-vars.tfvars b/syntax_test_terraform-vars.tfvars index 5ba6a6e..cbdf10a 100644 --- a/syntax_test_terraform-vars.tfvars +++ b/syntax_test_terraform-vars.tfvars @@ -88,13 +88,13 @@ # ^ punctuation.section.brackets.begin.terraform # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform constant.numeric.integer.terraform # ^ meta.braces.terraform punctuation.section.braces.end.terraform # ^ punctuation.separator.terraform # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform constant.numeric.integer.terraform # ^ meta.braces.terraform punctuation.section.braces.end.terraform # ^ punctuation.section.brackets.end.terraform @@ -110,11 +110,11 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform # ^ meta.function-call.terraform punctuation.section.parens.end.terraform diff --git a/syntax_test_terraform.tf b/syntax_test_terraform.tf index 647bde3..c3cad27 100644 --- a/syntax_test_terraform.tf +++ b/syntax_test_terraform.tf @@ -349,7 +349,7 @@ id = "db-final-snapshot-${md5(timestamp())}" # ^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^^ variable.declaration.terraform keyword.operator.assignment.terraform +# ^ keyword.operator.assignment.terraform # ^ string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^^^^^^^^^^^^^^ string.quoted.double.terraform # ^^ meta.interpolation.terraform punctuation.section.interpolation.begin.terraform @@ -372,7 +372,7 @@ # ^^ meta.interpolation.terraform punctuation.section.interpolation.begin.terraform # ^ meta.interpolation.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^^^^ meta.interpolation.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.interpolation.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.interpolation.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.interpolation.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.interpolation.terraform meta.braces.terraform punctuation.section.braces.end.terraform # ^ meta.interpolation.terraform punctuation.section.interpolation.end.terraform @@ -415,7 +415,7 @@ records = ["${replace("hostname.domain.com:1234", "/(.*):[0-9]{0,26}/", "$1")}"] # ^^^^^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^^ variable.declaration.terraform keyword.operator.assignment.terraform +# ^ keyword.operator.assignment.terraform # ^ punctuation.section.brackets.begin.terraform # ^ string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.interpolation.terraform punctuation.section.interpolation.begin.terraform @@ -762,10 +762,10 @@ // Handle nested arrays ///// - count = [ -# ^^^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^^ variable.declaration.terraform keyword.operator.assignment.terraform -# ^ punctuation.section.brackets.begin.terraform + counts = [ +# ^^^^^^ variable.declaration.terraform variable.other.readwrite.terraform +# ^ keyword.operator.assignment.terraform +# ^ punctuation.section.brackets.begin.terraform [ 1, 2], # ^ punctuation.section.brackets.begin.terraform # ^ constant.numeric.integer.terraform @@ -817,13 +817,13 @@ # ^ punctuation.section.brackets.begin.terraform # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform constant.numeric.integer.terraform # ^ meta.braces.terraform punctuation.section.braces.end.terraform # ^ punctuation.separator.terraform # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform constant.numeric.integer.terraform # ^ meta.braces.terraform punctuation.section.braces.end.terraform # ^ punctuation.section.brackets.end.terraform @@ -855,12 +855,12 @@ # ^ meta.braces.terraform punctuation.section.braces.begin.terraform name = "John" # ^^^^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^ meta.braces.terraform string.quoted.double.terraform age = 52 # ^^^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^^ meta.braces.terraform constant.numeric.integer.terraform } # ^ meta.braces.terraform punctuation.section.braces.end.terraform @@ -872,7 +872,7 @@ {name = "John", age = 52} # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^^^^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^ meta.braces.terraform string.quoted.double.terraform # ^ meta.braces.terraform punctuation.separator.terraform @@ -886,7 +886,7 @@ { name = 1 + 1 } # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^^^^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform constant.numeric.integer.terraform # ^ meta.braces.terraform keyword.operator.arithmetic.terraform # ^ meta.braces.terraform constant.numeric.integer.terraform @@ -900,7 +900,7 @@ { list = [ 1, 2, 3 ]} # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^^^^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform punctuation.section.brackets.begin.terraform # ^ meta.braces.terraform constant.numeric.integer.terraform # ^ meta.braces.terraform punctuation.separator.terraform @@ -919,7 +919,7 @@ # ^ meta.braces.terraform punctuation.section.braces.begin.terraform a = upper("l"), # ^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^^^^^ meta.braces.terraform meta.function-call.terraform support.function.builtin.terraform # ^ meta.braces.terraform meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.braces.terraform meta.function-call.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform @@ -937,15 +937,15 @@ # ^ meta.braces.terraform punctuation.section.braces.begin.terraform obj1 = { # ^^^^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform meta.braces.terraform punctuation.section.braces.begin.terraform obj2 = { # ^^^^ meta.braces.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform meta.braces.terraform meta.braces.terraform punctuation.section.braces.begin.terraform value = 5 # ^^^^^ meta.braces.terraform meta.braces.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform meta.braces.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform meta.braces.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform meta.braces.terraform meta.braces.terraform constant.numeric.integer.terraform } # ^ meta.braces.terraform meta.braces.terraform meta.braces.terraform punctuation.section.braces.end.terraform @@ -962,7 +962,7 @@ { lvalue = var.rvalue } # ^ meta.braces.terraform punctuation.section.braces.begin.terraform # ^^^^^^ meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^^^ meta.braces.terraform variable.language.terraform # ^ meta.braces.terraform punctuation.accessor.dot.terraform # ^^^^^^ meta.braces.terraform variable.other.member.terraform @@ -978,7 +978,7 @@ # ^ meta.braces.terraform meta.mapping.key.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^ meta.braces.terraform meta.mapping.key.terraform string.quoted.double.terraform # ^ meta.braces.terraform meta.mapping.key.terraform string.quoted.double.terraform punctuation.definition.string.end.terraform -# ^ meta.braces.terraform keyword.operator.terraform +# ^ meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^ meta.braces.terraform string.quoted.double.terraform # ^ meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.end.terraform @@ -1112,25 +1112,48 @@ // Basic definition ///// + attribute = "string" +# ^^^^^^^^^ variable.declaration.terraform variable.other.readwrite.terraform +# ^ keyword.operator.assignment.terraform +# ^^^^^^^^ meta.string.terraform string.quoted.double.terraform +# ^ punctuation.definition.string.begin.terraform +# ^ punctuation.definition.string.end.terraform + + +///// +// Meta-arguments +//// + + for_each = toset([]) +# ^^^^^^^^ keyword.control.loop.for.terraform +# ^ keyword.operator.assignment.terraform +# ^^^^^^^^^ meta.function-call.terraform +# ^^^^^ support.function.builtin.terraform +# ^ punctuation.section.parens.begin.terraform +# ^ punctuation.section.brackets.begin.terraform +# ^ punctuation.section.brackets.end.terraform +# ^ punctuation.section.parens.end.terraform + count = length(var.availability_zones) -# ^^^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^ variable.declaration.terraform keyword.operator.assignment.terraform -# ^^^^^^ meta.function-call.terraform support.function.builtin.terraform -# ^ meta.function-call.terraform punctuation.section.parens.begin.terraform -# ^^^ meta.function-call.terraform variable.language.terraform -# ^ meta.function-call.terraform punctuation.accessor.dot.terraform -# ^^^^^^^^^^^^^^^^^^ meta.function-call.terraform variable.other.member.terraform -# ^ meta.function-call.terraform punctuation.section.parens.end.terraform +# ^^^^^ variable.declaration.terraform keyword.control.conditional.terraform +# ^ keyword.operator.assignment.terraform +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.terraform +# ^^^^^^ support.function.builtin.terraform +# ^ punctuation.section.parens.begin.terraform +# ^^^ variable.language.terraform +# ^ punctuation.accessor.dot.terraform +# ^^^^^^^^^^^^^^^^^^ variable.other.member.terraform +# ^ punctuation.section.parens.end.terraform ///// // Populate an attribute from a variable value ///// (foo) = "baz" -# ^ variable.declaration.terraform punctuation.section.parens.begin.terraform +# ^ punctuation.section.parens.begin.terraform # ^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^ variable.declaration.terraform punctuation.section.parens.end.terraform -# ^ variable.declaration.terraform keyword.operator.assignment.terraform +# ^ punctuation.section.parens.end.terraform +# ^ keyword.operator.assignment.terraform # ^ string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^ string.quoted.double.terraform # ^ string.quoted.double.terraform punctuation.definition.string.end.terraform @@ -1202,11 +1225,11 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform @@ -1665,11 +1688,11 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform # ^ meta.function-call.terraform punctuation.section.parens.end.terraform @@ -1699,12 +1722,12 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform @@ -1756,14 +1779,14 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform # ^ meta.function-call.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform @@ -1877,7 +1900,7 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.brackets.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform @@ -1887,7 +1910,7 @@ # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.brackets.end.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.brackets.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform @@ -1903,15 +1926,15 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform # ^ meta.function-call.terraform punctuation.section.parens.end.terraform @@ -1978,7 +2001,7 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^^^^^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform @@ -2003,12 +2026,12 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.function-call.terraform punctuation.section.parens.end.terraform @@ -2107,13 +2130,13 @@ # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform port = 8080, # ^^^^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^^^^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform ip_addrs = ["10.0.0.1", "10.0.0.2"] # ^^^^^^^^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.brackets.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^^^^^ meta.function-call.terraform meta.braces.terraform string.quoted.double.terraform @@ -2370,11 +2393,11 @@ # ^ meta.function-call.terraform punctuation.section.parens.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.begin.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.separator.terraform # ^ meta.function-call.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.function-call.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.function-call.terraform meta.braces.terraform constant.numeric.integer.terraform # ^ meta.function-call.terraform meta.braces.terraform punctuation.section.braces.end.terraform # ^ meta.function-call.terraform punctuation.section.parens.end.terraform @@ -2407,6 +2430,15 @@ # ^^^^^^ meta.function-call.terraform string.quoted.double.terraform # ^ meta.function-call.terraform punctuation.section.parens.end.terraform + + provider::terraform::encode_tfvars({ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.terraform +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ support.function.builtin.terraform +# ^ punctuation.section.parens.begin.terraform +# ^ meta.braces.terraform punctuation.section.braces.begin.terraform + example = "Hello!" + }) + ///////////////////////////////////////////////////////////////////// // TUPLE FOR-EXPRESSIONS ///////////////////////////////////////////////////////////////////// @@ -2508,7 +2540,7 @@ value = [ # ^^^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^^ variable.declaration.terraform keyword.operator.assignment.terraform +# ^ keyword.operator.assignment.terraform # ^ punctuation.section.brackets.begin.terraform for instance in aws_instance.ubuntu: # ^^^ keyword.control.loop.for.terraform @@ -2531,7 +2563,7 @@ value = [ # ^^^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^^ variable.declaration.terraform keyword.operator.assignment.terraform +# ^ keyword.operator.assignment.terraform # ^ punctuation.section.brackets.begin.terraform for instance in aws_instance.ubuntu: # ^^^ keyword.control.loop.for.terraform @@ -2577,7 +2609,7 @@ value = [ # ^^^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^^ variable.declaration.terraform keyword.operator.assignment.terraform +# ^ keyword.operator.assignment.terraform # ^ punctuation.section.brackets.begin.terraform for instance in aws_instance.ubuntu: # ^^^ keyword.control.loop.for.terraform @@ -2753,7 +2785,7 @@ value = { # ^^^^^ variable.declaration.terraform variable.other.readwrite.terraform -# ^^ variable.declaration.terraform keyword.operator.assignment.terraform +# ^ keyword.operator.assignment.terraform # ^ meta.braces.terraform punctuation.section.braces.begin.terraform for l in var.letters: l => # ^^^ meta.braces.terraform keyword.control.loop.for.terraform @@ -2827,7 +2859,7 @@ # ^ meta.type.terraform meta.block.terraform punctuation.section.block.begin.terraform name = "example" # ^^^^ meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform +# ^ meta.block.terraform keyword.operator.assignment.terraform # ^ meta.block.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^^^^ meta.block.terraform string.quoted.double.terraform @@ -2837,26 +2869,26 @@ # ^^^^^^^^ meta.block.terraform meta.type.terraform string.quoted.double.terraform # ^ meta.block.terraform meta.type.terraform meta.block.terraform punctuation.section.block.begin.terraform for_each = var.service_ports -# ^^^^^^^^ meta.block.terraform meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform -# ^^^ meta.block.terraform meta.block.terraform variable.language.terraform -# ^ meta.block.terraform meta.block.terraform punctuation.accessor.dot.terraform -# ^^^^^^^^^^^^^ meta.block.terraform meta.block.terraform variable.other.member.terraform +# ^^^^^^^^ variable.declaration.terraform keyword.control.loop.for.terraform +# ^ keyword.operator.assignment.terraform +# ^^^ variable.language.terraform +# ^ punctuation.accessor.dot.terraform +# ^^^^^^^^^^^^^ variable.other.member.terraform content { # ^^^^^^^ meta.block.terraform meta.block.terraform meta.type.terraform entity.name.type.terraform # ^ meta.block.terraform meta.block.terraform meta.type.terraform meta.block.terraform punctuation.section.block.begin.terraform from_port = ingress.value # ^^^^^^^^^ meta.block.terraform meta.block.terraform meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform meta.block.terraform meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform +# ^ meta.block.terraform meta.block.terraform meta.block.terraform keyword.operator.assignment.terraform # ^ meta.block.terraform meta.block.terraform meta.block.terraform punctuation.accessor.dot.terraform # ^^^^^ meta.block.terraform meta.block.terraform meta.block.terraform variable.other.member.terraform to_port = ingress.value # ^^^^^^^ meta.block.terraform meta.block.terraform meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform meta.block.terraform meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform +# ^ meta.block.terraform meta.block.terraform meta.block.terraform keyword.operator.assignment.terraform # ^ meta.block.terraform meta.block.terraform meta.block.terraform punctuation.accessor.dot.terraform protocol = "tcp" + "IP" # ^^^^^^^^ meta.block.terraform meta.block.terraform meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform meta.block.terraform meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform +# ^ meta.block.terraform meta.block.terraform meta.block.terraform keyword.operator.assignment.terraform # ^ meta.block.terraform meta.block.terraform meta.block.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^ meta.block.terraform meta.block.terraform meta.block.terraform string.quoted.double.terraform # ^ meta.block.terraform meta.block.terraform meta.block.terraform keyword.operator.arithmetic.terraform @@ -2880,17 +2912,17 @@ # ^ meta.type.terraform meta.block.terraform punctuation.section.block.begin.terraform func = function(param1) # ^^^^ meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform +# ^ meta.block.terraform keyword.operator.assignment.terraform # ^^^^^^^^ meta.block.terraform meta.function-call.terraform variable.function.terraform # ^ meta.block.terraform meta.function-call.terraform punctuation.section.parens.begin.terraform # ^^^^^^ meta.block.terraform meta.function-call.terraform # ^ meta.block.terraform meta.function-call.terraform punctuation.section.parens.end.terraform obj = { # ^^^ meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform +# ^ meta.block.terraform keyword.operator.assignment.terraform key = "value" # ^^^ meta.block.terraform meta.braces.terraform meta.mapping.key.terraform string.unquoted.terraform -# ^ meta.block.terraform meta.braces.terraform keyword.operator.terraform +# ^ meta.block.terraform meta.braces.terraform keyword.operator.assignment.terraform # ^ meta.block.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.begin.terraform # ^^^^^^ meta.block.terraform meta.braces.terraform string.quoted.double.terraform # ^ meta.block.terraform meta.braces.terraform string.quoted.double.terraform punctuation.definition.string.end.terraform @@ -2898,7 +2930,7 @@ # ^ meta.block.terraform meta.braces.terraform punctuation.section.braces.end.terraform tuple = [1, 2] # ^^^^^ meta.block.terraform variable.declaration.terraform variable.other.readwrite.terraform -# ^^ meta.block.terraform variable.declaration.terraform keyword.operator.assignment.terraform +# ^ meta.block.terraform keyword.operator.assignment.terraform # ^ meta.block.terraform punctuation.section.brackets.begin.terraform # ^ meta.block.terraform constant.numeric.integer.terraform # ^ meta.block.terraform punctuation.separator.terraform @@ -2946,6 +2978,21 @@ # ^ punctuation.accessor.dot.terraform # ^^^^^^^^^ variable.other.member.terraform + count.index +# ^^^^^ variable.language.terraform +# ^ punctuation.accessor.dot.terraform +# ^^^^^ variable.other.member.terraform + + each.key +# ^^^^ variable.language.terraform +# ^ punctuation.accessor.dot.terraform +# ^^^ variable.other.member.terraform + + self.private_ip +# ^^^^ variable.language.terraform +# ^ punctuation.accessor.dot.terraform +# ^^^^^^^^^^ variable.other.member.terraform + ///////////////////////////////////////////////////////////////////// // TERRAFORM TOP-LEVEL BLOCK TYPES /////////////////////////////////////////////////////////////////////