{ "name": "Terraform", "scopeName": "source.terraform", "patterns": [ { "name": "comment.line.number-sign.terraform", "begin": "#|//", "end": "$\\n?", "captures": { "0": { "name": "punctuation.definition.comment.terraform" } } }, { "name": "comment.block.terraform", "begin": "/\\*", "end": "\\*/", "captures": { "0": { "name": "punctuation.definition.comment.terraform" } } }, { "name": "constant.language.terraform", "match": "\\b(true|false|yes|no|on|off)\\b" }, { "name": "constant.numeric.terraform", "match": "\\b([0-9]+)([kKmMgG]b?)?\\b" }, { "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+({)", "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+({)", "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" } } }, { "match": "([\\w_-]+)\\s*(=)\\s*", "captures": { "1": { "name": "variable.other.assignment.terraform" }, "2": { "name": "keyword.operator.terraform" } } }, { "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" } } }, { "match": "([\\w\\-_]+)\\s+({)", "captures": { "1": { "name": "entity.name.section.terraform" }, "2": { "name": "punctuation.definition.tag.terraform" } } }, { "include": "#strings" }, { "name": "string.unquoted.heredoc.terraform", "begin": "(?\u003e\\s*\u003c\u003c(\\w+))", "end": "^\\s*\\1$", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.terraform" }, "1": { "name": "keyword.operator.heredoc.terraform" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.terraform keyword.operator.heredoc.terraform" } } } ], "repository": { "string_interpolation": { "patterns": [ { "name": "source.terraform.embedded.source", "begin": "\\$\\{", "end": "\\}", "patterns": [ { "include": "$self" }, { "include": "#string_interpolation_functions" }, { "include": "#string_interpolation_keywords" }, { "match": "(\\.)", "captures": { "0": { "name": "keyword.control.period.terraform" } } }, { "include": "#strings" } ], "beginCaptures": { "0": { "name": "entity.tag.embedded.start.terraform" } }, "endCaptures": { "0": { "name": "entity.tag.embedded.end.terraform" } } } ] }, "string_interpolation_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)(\\()", "end": "(\\))", "patterns": [ { "include": "#string_interpolation_functions" }, { "include": "#string_interpolation_keywords" } ], "beginCaptures": { "1": { "name": "keyword.other.function.inline.terraform" }, "2": { "name": "keyword.other.section.begin.terraform" } }, "endCaptures": { "1": { "name": "keyword.other.section.end.terraform" } } }, "string_interpolation_keywords": { "match": "(terraform|var|self|count|module|path|data)(\\.[\\w\\*]+)+", "captures": { "0": { "name": "entity.other.attribute-name.terraform" } } }, "strings": { "begin": "\\\"", "end": "\\\"", "patterns": [ { "include": "#string_interpolation" }, { "name": "string.quoted.double.terraform", "match": "([\\w\\-\\/\\._\\\\%]+)" } ], "beginCaptures": { "0": { "name": "string.terraform punctuation.definition.string.begin.terraform" } }, "endCaptures": { "0": { "name": "string.terraform punctuation.definition.string.end.terraform" } } } } }