Merge pull request #1882 from derBroBro/terraform-support
Terraform support
This commit is contained in:
commit
9b9c1e5960
|
@ -186,3 +186,9 @@ before_install:
|
|||
else
|
||||
pip install beautysh;
|
||||
fi
|
||||
# terraform
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
brew install terraform;
|
||||
else
|
||||
docker pull hashicorp/terraform;
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Next
|
||||
- See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt.
|
||||
- See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2!
|
||||
- Fix for [#1888](https://github.com/Glavin001/atom-beautify/issues/1888). Allow 0 for minor and patch versions of Docker
|
||||
- Add Settings to atom-beautify in Packages menu [#1869](https://github.com/Glavin001/atom-beautify/issues/1869)
|
||||
|
|
|
@ -111,6 +111,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall
|
|||
| SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax<br/> |
|
||||
| sqlformat | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/andialbrecht/sqlparse and follow the instructions. |
|
||||
| stylish-haskell | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/jaspervdj/stylish-haskell and follow the instructions. |
|
||||
| terraformfmt | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [Terraform (`terraform`)](https://www.terraform.io) with `docker pull hashicorp/terraform`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [Terraform (`terraform`)](https://www.terraform.io) by following https://www.terraform.io<br/> |
|
||||
| Tidy Markdown | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
|
||||
| TypeScript Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
|
||||
| Uncrustify | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) with `docker pull unibeautify/uncrustify`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) by following https://github.com/uncrustify/uncrustify<br/> |
|
||||
|
@ -178,6 +179,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
|
|||
| SQL | `SQL (Rails)`, `SQL` |`.sql` | **[`sqlformat`](https://github.com/andialbrecht/sqlparse)** |
|
||||
| SVG | `SVG` |`.svg` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||
| Swig | `HTML (Swig)`, `SWIG` |`.swig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||
| Terraform | `Terraform` |`.tf` | **[`terraformfmt`](https://www.terraform.io/docs/commands/fmt.html)** |
|
||||
| TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||
| Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||
| TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** |
|
||||
|
|
|
@ -98,6 +98,10 @@ install:
|
|||
- cinst emacs -y
|
||||
- where emacs
|
||||
|
||||
# terraform
|
||||
- cinst terraform -y
|
||||
- where terraform
|
||||
|
||||
# FIXME: Enable allowEmptyChecksums, until someone fixes the checksum issue of php
|
||||
- choco feature enable -n allowEmptyChecksums
|
||||
# PHP
|
||||
|
|
|
@ -11,8 +11,6 @@ You can use [`codo`](https://github.com/coffeedoc/codo) to build your own docume
|
|||
After you make a change to language or beautifier `options` you will need to update the `options.json` file that is created on install.
|
||||
|
||||
```bash
|
||||
# Update src/options.json file to have new/changed options
|
||||
npm run postinstall
|
||||
# Update documentation to include information about those options
|
||||
npm run docs
|
||||
```
|
||||
|
|
|
@ -368,6 +368,23 @@ Options for SassConvert executable.
|
|||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||
3. Find the option "*SassConvert*" and change it to your desired configuration.
|
||||
|
||||
##### [Terraform](#terraform)
|
||||
|
||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||
|
||||
**Type**: `object`
|
||||
|
||||
**Description**:
|
||||
|
||||
Options for Terraform executable.
|
||||
|
||||
**How to Configure**
|
||||
|
||||
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
|
||||
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
|
||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||
3. Find the option "*Terraform*" and change it to your desired configuration.
|
||||
|
||||
##### [Uncrustify](#uncrustify)
|
||||
|
||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||
|
@ -12171,6 +12188,75 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff)
|
|||
}
|
||||
```
|
||||
|
||||
#### [Terraform](#terraform)
|
||||
|
||||
**Supported Beautifiers**: [`terraformfmt`](#terraformfmt)
|
||||
|
||||
| Option | terraformfmt |
|
||||
| --- | --- |
|
||||
| `disabled` | :white_check_mark: |
|
||||
| `default_beautifier` | :white_check_mark: |
|
||||
| `beautify_on_save` | :white_check_mark: |
|
||||
|
||||
**Description**:
|
||||
|
||||
Options for language Terraform
|
||||
|
||||
##### [Disable Beautifying Language](#disable-beautifying-language)
|
||||
|
||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable Terraform Beautification
|
||||
|
||||
**How to Configure**
|
||||
|
||||
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
|
||||
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
|
||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||
3. Find the option "*Disable Beautifying Language*" and change it to your desired configuration.
|
||||
|
||||
##### [Default Beautifier](#default-beautifier)
|
||||
|
||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||
|
||||
**Default**: `terraformfmt`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `terraformfmt`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for Terraform
|
||||
|
||||
**How to Configure**
|
||||
|
||||
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
|
||||
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
|
||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||
3. Find the option "*Default Beautifier*" and change it to your desired configuration.
|
||||
|
||||
##### [Beautify On Save](#beautify-on-save)
|
||||
|
||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify Terraform files on save
|
||||
|
||||
**How to Configure**
|
||||
|
||||
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
|
||||
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
|
||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||
3. Find the option "*Beautify On Save*" and change it to your desired configuration.
|
||||
|
||||
#### [TSS](#tss)
|
||||
|
||||
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
resource "aws_db_instance" "wordpress" {
|
||||
# worng spaces # to much spaces
|
||||
|
||||
allocated_storage = 10
|
||||
storage_type = "gp2"
|
||||
engine = "mariadb"
|
||||
engine_version = "10.0.24"
|
||||
|
||||
instance_class = "db.t2.micro"
|
||||
identifier = "db-${var.env}"
|
||||
name = "wordpress"
|
||||
|
||||
username = "wordpress"
|
||||
password = "${var.wordpress_db_pass}"
|
||||
db_subnet_group_name = "${aws_db_subnet_group.default.name}"
|
||||
vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"]
|
||||
apply_immediately = true
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
resource "aws_db_instance" "wordpress" {
|
||||
# worng spaces
|
||||
# to much spaces
|
||||
|
||||
allocated_storage = 10
|
||||
storage_type = "gp2"
|
||||
engine = "mariadb"
|
||||
engine_version = "10.0.24"
|
||||
|
||||
instance_class = "db.t2.micro"
|
||||
identifier = "db-${var.env}"
|
||||
name = "wordpress"
|
||||
|
||||
|
||||
|
||||
username = "wordpress"
|
||||
password = "${var.wordpress_db_pass}"
|
||||
db_subnet_group_name = "${aws_db_subnet_group.default.name}"
|
||||
vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"]
|
||||
apply_immediately = true
|
||||
}
|
|
@ -276,7 +276,8 @@
|
|||
"atom-beautify:beautify-language-visualforce",
|
||||
"atom-beautify:beautify-language-xml",
|
||||
"atom-beautify:beautify-language-xtemplate",
|
||||
"atom-beautify:beautify-language-yaml"
|
||||
"atom-beautify:beautify-language-yaml",
|
||||
"atom-beautify:beautify-language-terraform"
|
||||
],
|
||||
".tree-view .file .name": [
|
||||
"atom-beautify:beautify-file"
|
||||
|
@ -409,7 +410,9 @@
|
|||
"nginx beautify",
|
||||
"golang template",
|
||||
"align-yaml",
|
||||
"goimports"
|
||||
"goimports",
|
||||
"terraform",
|
||||
"terraformfmt"
|
||||
],
|
||||
"devDependencies": {
|
||||
"coffeelint": "1.16.0"
|
||||
|
@ -446,4 +449,4 @@
|
|||
"prettydiff2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -80,6 +80,7 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
'marko-beautifier'
|
||||
'formatR'
|
||||
'beautysh'
|
||||
'terraformfmt'
|
||||
]
|
||||
|
||||
###
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
###
|
||||
Requires terraform installed
|
||||
###
|
||||
|
||||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
module.exports = class Terraformfmt extends Beautifier
|
||||
name: "terraformfmt"
|
||||
link: "https://www.terraform.io/docs/commands/fmt.html"
|
||||
|
||||
options: {
|
||||
Terraform: false
|
||||
}
|
||||
|
||||
executables: [
|
||||
{
|
||||
name: "Terraform"
|
||||
cmd: "terraform"
|
||||
homepage: "https://www.terraform.io"
|
||||
installation: "https://www.terraform.io"
|
||||
version: {
|
||||
parse: (text) -> text.match(/Terraform v(\d+\.\d+\.\d+)/)[1]
|
||||
}
|
||||
docker: {
|
||||
image: "hashicorp/terraform"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
@exe("terraform").run([
|
||||
"fmt"
|
||||
tempFile = @tempFile("input", text)
|
||||
])
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
|
@ -77,6 +77,7 @@ module.exports = class Languages
|
|||
"xml"
|
||||
"xtemplate"
|
||||
"yaml"
|
||||
"terraform"
|
||||
]
|
||||
|
||||
###
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
module.exports = {
|
||||
|
||||
name: "Terraform"
|
||||
namespace: "terraform"
|
||||
fallback: ['js']
|
||||
|
||||
###
|
||||
Supported Grammars
|
||||
###
|
||||
grammars: [
|
||||
"Terraform"
|
||||
]
|
||||
|
||||
###
|
||||
Supported extensions
|
||||
###
|
||||
extensions: [
|
||||
"tf"
|
||||
]
|
||||
}
|
|
@ -9128,6 +9128,47 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"terraform": {
|
||||
"title": "Terraform",
|
||||
"type": "object",
|
||||
"description": "Options for language Terraform",
|
||||
"collapsed": true,
|
||||
"beautifiers": [
|
||||
"terraformfmt"
|
||||
],
|
||||
"grammars": [
|
||||
"Terraform"
|
||||
],
|
||||
"extensions": [
|
||||
"tf"
|
||||
],
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"title": "Disable Beautifying Language",
|
||||
"order": -3,
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Disable Terraform Beautification"
|
||||
},
|
||||
"default_beautifier": {
|
||||
"title": "Default Beautifier",
|
||||
"order": -2,
|
||||
"type": "string",
|
||||
"default": "terraformfmt",
|
||||
"description": "Default Beautifier to be used for Terraform",
|
||||
"enum": [
|
||||
"terraformfmt"
|
||||
]
|
||||
},
|
||||
"beautify_on_save": {
|
||||
"title": "Beautify On Save",
|
||||
"order": -1,
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Automatically beautify Terraform files on save"
|
||||
}
|
||||
}
|
||||
},
|
||||
"executables": {
|
||||
"title": "Executables",
|
||||
"type": "object",
|
||||
|
@ -9374,6 +9415,22 @@
|
|||
"description": "Absolute path to the \"beautysh\" executable's binary/script."
|
||||
}
|
||||
}
|
||||
},
|
||||
"terraform": {
|
||||
"key": "terraform",
|
||||
"title": "Terraform",
|
||||
"type": "object",
|
||||
"collapsed": true,
|
||||
"description": "Options for Terraform executable.",
|
||||
"properties": {
|
||||
"path": {
|
||||
"key": "path",
|
||||
"title": "Binary/Script Path",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "Absolute path to the \"terraform\" executable's binary/script."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue