├── .gitignore ├── settings └── language-terraform.cson ├── package.json ├── README.md ├── LICENSE.md ├── example.tf ├── grammars ├── interpolated.cson └── terraform.cson ├── CHANGELOG.md └── snippets └── snippets.cson /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /settings/language-terraform.cson: -------------------------------------------------------------------------------- 1 | '.source.terraform': 2 | 'editor': 3 | 'commentStart': '# ' 4 | 'increaseIndentPattern': '^.*(\\{[^}]*|\\[[^\\]]*)$' 5 | 'decreaseIndentPattern': '^\\s*[}\\]],?\\s*$' 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-terraform", 3 | "description": "Terraform.io support for Atom", 4 | "version": "0.9.7", 5 | "keywords": [ 6 | "language", 7 | "grammar", 8 | "terraform", 9 | "terraform-0-12", 10 | "configuration" 11 | ], 12 | "engines": { 13 | "atom": "*", 14 | "node": "*" 15 | }, 16 | "homepage": "https://github.com/cmur2/language-terraform", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/cmur2/language-terraform.git" 20 | }, 21 | "license": "MIT", 22 | "bugs": { 23 | "url": "https://github.com/cmur2/language-terraform/issues" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Terraform.io language support for Atom 2 | 3 | Adds syntax highlighting for Terraform.io configuration files to Atom. 4 | 5 | ## Installation 6 | 7 | Available as [Atom package](https://atom.io/packages/language-terraform): 8 | 9 | ``` 10 | apm install language-terraform 11 | ``` 12 | 13 | Or directly via git: 14 | 15 | ``` 16 | git clone https://github.com/cmur2/language-terraform.git ~/.atom/packages/language-terraform 17 | ``` 18 | 19 | Migrate from **deprecated** fork `language-terraform-12` package back to this official, [maintained](https://github.com/cmur2/language-terraform/issues/46) package which includes all features from the fork: 20 | 21 | ``` 22 | apm uninstall language-terraform-12 && apm install language-terraform 23 | ``` 24 | 25 | ## Contributions 26 | 27 | Contributions are not only welcome, but encouraged. Please fork and submit pull requests for snippets, grammar tweaks, etc. 28 | 29 | ## License 30 | 31 | language-terraform is licensed under the MIT License. See LICENSE for more information. 32 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /example.tf: -------------------------------------------------------------------------------- 1 | # taken from https://github.com/hashicorp/terraform/blob/master/examples/aws-s3-cross-account-access/main.tf 2 | 3 | # TODO: this tests integration with language-todo 4 | 5 | provider "aws" { 6 | alias = "prod" 7 | 8 | region = "us-east-1" 9 | access_key = "${var.prod_access_key}" 10 | secret_key = "${var.prod_secret_key}" 11 | number = 12 12 | example = true 13 | list = [true, false, 123, "$${var.foo.*} = ${var.foo.*}"] 14 | } 15 | 16 | // NOTE Another comment for a great resource 17 | resource "aws_s3_bucket" "prod" { 18 | provider = "aws.prod" 19 | 20 | bucket = "${concat(var.bucket_name, 4 - 3)}" 21 | acl = "private" 22 | policy = < instance.public 60 | if instance.associate_public_ip_address 61 | } 62 | } 63 | 64 | resource "aws_subnet" "example" { 65 | for_each = var.subnet_numbers 66 | 67 | vpc_id = aws_vpc.example.id 68 | availability_zone = each.key 69 | cidr_block = cidrsubnet(aws_vpc.example.cidr_block, 8, each.value) 70 | } 71 | 72 | /* 73 | * FIXME(nobody): Nothing 74 | */ 75 | -------------------------------------------------------------------------------- /grammars/interpolated.cson: -------------------------------------------------------------------------------- 1 | scopeName: 'text.interpolation.hashicorp' 2 | name: 'HashiCorp String Interpolation' 3 | injectionSelector: 'string.interpolated' 4 | 5 | patterns: [ 6 | { 7 | name: 'string' 8 | match: '\\$\\$' 9 | } 10 | { 11 | begin: '(\\$\\{)' 12 | beginCaptures: 13 | 1: 14 | name: 'variable.interpolation.begin' 15 | end: '(\\})' 16 | endCaptures: 17 | 1: 18 | name: 'variable.interpolation.end' 19 | name: 'none' 20 | patterns: [ 21 | {include: '#interplang'} 22 | ] 23 | } 24 | ] 25 | 26 | repository: 27 | interplang: 28 | patterns: [ 29 | { 30 | match: '\\b(abs|basename|base64decode|base64encode|base64gzip|base64sha256|base64sha512|bcrypt|can|ceil|chomp|chunklist|cidrhost|cidrnetmask|cidrsubnet|coalesce|coalescelist|compact|concat|contains|dirname|distinct|element|file|floor|flatten|format|formatlist|indent|index|join|jsonencode|keys|length|list|log|lookup|lower|map|matchkeys|max|merge|min|md5|pathexpand|pow|replace|rsadecrypt|sha1|sha256|sha512|signum|slice|sort|split|substr|timestamp|timeadd|title|tobool|tolist|tomap|tonumber|toset|tostring|try|transpose|trimspace|upper|urlencode|uuid|values|zipmap)\\s*(?:\\()' 31 | captures: 32 | 1: 33 | name: 'support.function' 34 | 2: 35 | name: 'meta.brace.round' 36 | } 37 | { 38 | match: '\\b(count|data|each|local|module|self|terraform|var)\\b' 39 | name: 'support.variable' 40 | } 41 | { 42 | match: '\\b\\d+\\b' 43 | name: 'constant.numeric' 44 | } 45 | { 46 | comment: 'Handle curly braces in regex eg. {1,2}' 47 | match: '(?:\\{)(\\d*)(?:,?)(\\d*)(?:\\})' 48 | captures: 49 | 1: 50 | name: 'constant.numeric' 51 | 2: 52 | name: 'constant.numeric' 53 | } 54 | { 55 | begin: '(\\$\\{)' 56 | beginCaptures: 57 | 1: 58 | name: 'variable.interpolation.begin' 59 | end: '(\\})' 60 | endCaptures: 61 | 1: 62 | name: 'variable.interpolation.end' 63 | name: 'none' 64 | patterns: [ 65 | {include: '#interplang'} 66 | ] 67 | } 68 | { 69 | match: '\\*' 70 | name: 'support.constant' 71 | } 72 | ] 73 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.0 - First Release 2 | * Experimental language support for Terraform.io configurations 3 | 4 | ## 0.1.0 - Second Release 5 | * Add support for nested provisioning statements 6 | 7 | ## 0.2.0 - Third Release 8 | * Better names for capture groups 9 | 10 | ## 0.3.0 - Fourth Release 11 | * Fix for comments (thanks frntn) 12 | 13 | ## 0.4.0 - Fifth Release 14 | * Fix for "${a.b}" style strings. (thanks sbward) 15 | 16 | ## 0.5.0 17 | * Fix for nested interpolated strings not parsing correctly 18 | * Fix for comments not parsing correctly inside blocks 19 | 20 | ## 0.6.0 - Thanks Ryan Graham (rmg) 21 | * multi-line comments 22 | * booleans 23 | * number literals, including supported suffixes 24 | * syntax highlighting inside string interpolations 25 | * functions 26 | * variables 27 | * literals 28 | * support for heredoc strings 29 | * embedded syntax hightlighting based on token suffix (<