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