{ "fileTypes": [ "tf", "tfvars", "hcl" ], "name": "Terraform", "patterns": [ { "begin": "#|//", "captures": { "0": { "name": "punctuation.definition.comment.terraform" } }, "comment": "Comments", "end": "$\\n?", "name": "comment.line.number-sign.terraform" }, { "begin": "/\\*", "captures": { "0": { "name": "punctuation.definition.comment.terraform" } }, "comment": "Block comments", "end": "\\*/", "name": "comment.block.terraform" }, { "comment": "Language constants (true, false, yes, no, on, off)", "match": "\\b(true|false|yes|no|on|off)\\b", "name": "constant.language.terraform" }, { "comment": "Numbers", "match": "\\b([0-9]+)([kKmMgG]b?)?\\b", "name": "constant.numeric.terraform" }, { "comment": "Hex numbers", "match": "\\b(0x[0-9A-Fa-f]+)([kKmMgG]b?)?\\b", "name": "constant.numeric.terraform" }, { "captures": { "1": { "name": "storage.type.function.terraform" }, "2": { "name": "string.terraform punctuation.definition.string.begin.terraform" }, "3": { "name": "string.value.terraform" }, "4": { "name": "string.terraform punctuation.definition.string.end.terraform" }, "5": { "name": "string.terraform punctuation.definition.string.begin.terraform" }, "6": { "name": "string.value.terraform" }, "7": { "name": "string.terraform punctuation.definition.string.end.terraform" }, "8": { "name": "punctuation.definition.tag.terraform" } }, "foldingStartMarker": "\\{\\s*$", "foldingStopMarker": "^\\s*\\}", "match": "(resource|data)\\s+(\")?(\\w+)(\")?\\s+(\")?([\\w\\-]+)(\")?\\s+({)", "name": "meta.resource.terraform" }, { "captures": { "1": { "name": "storage.type.function.terraform" }, "2": { "name": "string.terraform punctuation.definition.string.begin.terraform" }, "3": { "name": "string.value.terraform" }, "4": { "name": "string.terraform punctuation.definition.string.end.terraform" }, "5": { "name": "punctuation.definition.tag.terraform" } }, "foldingStartMarker": "\\{\\s*$", "foldingStopMarker": "^\\s*\\}", "match": "(provider|provisioner|variable|output|module|atlas)\\s+(\")?([\\w\\-]+)(\")?\\s+({)" }, { "captures": { "1": { "name": "variable.other.assignment.terraform" }, "2": { "name": "keyword.operator.terraform" } }, "comment": "Value assignments (left hand side not in double quotes)", "match": "([\\w_-]+)\\s*(=)\\s*" }, { "captures": { "1": { "name": "punctuation.quote.double.terraform" }, "2": { "name": "variable.assignment.terraform" }, "3": { "name": "punctuation.quote.double.terraform" }, "4": { "name": "keyword.operator.terraform" } }, "comment": "Value assignments (left hand side in double quotes)", "match": "(\")([\\w_-]+)(\")\\s*(=)\\s*" }, { "captures": { "1": { "name": "entity.name.section.terraform" }, "2": { "name": "punctuation.definition.tag.terraform" } }, "comment": "Maps", "match": "([\\w\\-_]+)\\s+({)" }, { "include": "#strings" }, { "begin": "(?>\\s*<<(\\w+))", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.terraform" }, "1": { "name": "keyword.operator.heredoc.terraform" } }, "end": "^\\1$", "endCaptures": { "0": { "name": "punctuation.definition.string.end.terraform keyword.operator.heredoc.terraform" } }, "name": "string.unquoted.heredoc.terraform" } ], "repository": { "string_interpolation": { "patterns": [ { "begin": "\\$\\{", "beginCaptures": { "0": { "name": "entity.tag.embedded.start.terraform" } }, "end": "\\}", "endCaptures": { "0": { "name": "entity.tag.embedded.end.terraform" } }, "name": "source.terraform.embedded.source", "patterns": [ { "include": "$self" }, { "include": "#string_interpolation_functions" }, { "include": "#string_interpolation_keywords" }, { "captures": { "0": { "name": "keyword.control.period.terraform" } }, "match": "(\\.)" }, { "include": "#strings" } ] } ] }, "string_interpolation_functions": { "begin": "(base64decode|base64encode|base64sha256|ceil|cidrnetmask|compact|distinct|file|floor|keys|length|lower|md5|pathexpand|replace|sha1|sha256|signum|sort|timestamp|title|trimspace|upper|uuid|values|cidrhost|cidrsubnet|coalesce|concat|element|format|formatlist|from|index|join|jsonencode|length|list|lookup|map|max|merge|min|slice|split|substr|zipmap)(\\()", "beginCaptures": { "1": { "name": "keyword.other.function.inline.terraform" }, "2": { "name": "keyword.other.section.begin.terraform" } }, "comment": "Builtin functions", "end": "(\\))", "endCaptures": { "1": { "name": "keyword.other.section.end.terraform" } }, "patterns": [ { "include": "$self" }, { "include": "#string_interpolation_keywords" } ] }, "string_interpolation_keywords": { "captures": { "0": { "name": "entity.other.attribute-name.terraform" } }, "match": "(terraform|var|self|count|module|path|data)(\\.[\\w\\*]+)+" }, "strings": { "begin": "\\\"", "beginCaptures": { "0": { "name": "string.terraform punctuation.definition.string.begin.terraform" } }, "comment": "Strings", "end": "\\\"", "endCaptures": { "0": { "name": "string.terraform punctuation.definition.string.end.terraform" } }, "patterns": [ { "include": "#string_interpolation" }, { "match": "([\\w\\-\\/\\._\\\\%]+)", "name": "string.quoted.double.terraform" } ] } }, "scopeName": "source.terraform", "uuid": "9060ca81-906d-4f19-a91a-159f4eb119d6" }