HCL language support

Compatible with: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider Android Studio
11.05.2017
57 245
This plugin adds support for HashiCorp Configuration Language (HCL) and HashiCorp Interpolation Language (HIL) languages
And their combination, Terraform configuration files (.tf)
Also HCL format is used for Nomad(.nomad files).
Features: For file formats with HCL (.hcl, .tf, .nomad):
  • Syntax highlighting
  • Structure outline in 'Structure' tool window
  • Code formatter, so reformat code action available
  • Code folding
  • Comment/Uncomment action
HashiCorp Interpolation Language:
  • Syntax highlighting
Terraform specific support: In both config and interpolations:
  • Autocompletion
  • Find Usages / Go to definition for resources, providers, variables and their properties
  • Rename Refactoring
  • Introduce Variable Refactoring (for string property values)
  • Several inspections
  • Report usage of deprecated properties
  • Unresolved reference checks (in interpolations)
  • Check required/missing properties in resource/provider
  • Predefined Terraform methods autocompletion in interpolations
  • (WIP) Better properties validation (type checking)
  • (WIP) Working with dependent modules
  • (WIP) Type-specific autocompletion in interpolations

Download plugin

Recent change notes

0.6.3

Support for `backend` blocks in `terraform` block

Custom folding support: `region/endregion` and `<editor-fold>

Required properties added automatically on resource/data type completion and in generators

Smart completion in interpolations provides best suited results for some properties, e.g. vpc_id in aws resources

Move statement up/down doesn't breaks syntax anymore

Other improvements and bugfixes in completion

Updated model data to match Terraform v0.9.5

0.6.2

Support `${terraform.env}` interpolation

Improve resolving for 'computed' map variables

Updated model data to match Terraform v0.9.4

0.6.1

Added 'Add missing variable' quick fix

Do not highlight terraform_remote_state parameters as missing

Updated Terraform model data to match TF v0.9.3

0.6.0

Added 'Introduce Variable' refactoring (#50)

Resource and Data Source completion variants for unused providers no longer shown in basic completion (#77)

Added completion, Go To Definition and find usages from module 'source' property for relative path cases (#73)

Updated terraform model data to match Terraform v0.9.0

0.5.12.2

Updated terraform model data to match Terraform v0.8.6

Minor internal refactoring, plugin size reduced a bit

0.5.12.1

Support 'terraform' blocks in .tf files (#68)

Updated terraform model data to match Terraform v0.8.4

0.5.12

Allow 'self' references in interpolation in resource connection blocks (#57)

Support comparison and boolean operations in interpolation (#59)

Report incorrect argument types for comparison, ternary and boolean operations in interpolations (simple cases only)

Properly insert closing curve brace once interpolation start typed (#63)

Fixed 'module' keyword highlighting and completion in interpolations (#62)

Completion for module output in interpolations, module inputs no longer advised in interpolations completion (#52)

Added completion for module parameters as well as 'missing parameter' inspection (#65, #66)

Updated terraform model data to match Terraform v0.8.1

0.5.11.1

Fixed IAE (#55)

Fixed incorrect backslash escape handling (#56)

Removed Otto support since that tool was decommissioned

0.5.11

Support Terraform 0.8.0

'Missing required property' inspection now ignores required properties with 'default' value. (#53)

Multiline string literals supported only if there's interpolation inside.

Backslash escaping changed in interpolations to match Terraform 0.8 style. Details in HCL repo.

Do not highlight interpolation elements as unresolved reference for some holders, e.g. `VAR` in `data.consul.NAME.var.VAR` (#51)

Updated terraform model data to match Terraform v0.8.0-rc1

0.5.10

'Copy Reference' action would copy FQN of resource, provider, etc. (#48)

Updated terraform model data to match Terraform 0.7.5 (#49)

0.5.9

Updated terraform model data to match Terraform 0.7.4

0.5.8

Add references and completion variants for 'depends_on' in resources and data sources (#43)

Updated terraform model data to match Terraform 0.7.2

0.5.7

Fixed incorrect inspection in .tfvars files for numeric values (#41)

Fixed double quote inserter in Terraform files, now closing double quote would be added automatically if needed

Improved missing properties generation in 'Missing required property' inspection based on expected property type

Improved property name completion elements presentation

Variable type could be autocompleted from three variants: string, list or map

Variable type inspection (for 'type' and 'default' properties)

Report duplicated providers with same name/alias as error

Report usage of interpolations in variables, 'depends_on' and module source as error

0.5.6

Fixed incorrect inspection in .tfvars files (#39)

Support references to elements of 'map' variables in .tfvars files (#41)

Code completion in .tfvars files (#41)

Support multiline interpolations in heredocs (#40)

0.5.5

Support Terraform 0.7.0 (issues: #31, #33, #36, #37)

Updated terraform model data to match Terraform 0.7.0

0.5.4

Fixed error on rename refactoring (issue #29)

Fixed parsing heredocs with indented end token (issue #30)

Fixed interpolation escape (`$$`) (issue #34)

Updated terraform model data to match Terraform 0.6.16

0.5.3

Updated terraform model data to match Terraform 0.6.15 (issue #28)

0.5.2

Updated terraform model data to match Terraform 0.6.14

Support indented heredocs (issue #27)

Support '.tfvars' files (issue #24)

Fixed exception during formatting a .tf file with invalid syntax (issue #26)

0.5.1

Updated terraform model data to match Terraform 0.6.12

Fix references to resource 'id' property reported as unresolved (issue #21)

Fixes around unary operators in HIL

Support indexing into variables in HIL ('${a[2]}') (issue #19)

Various fixes

0.5.0

Customize highlighting text attributes (colour, etc)

Improved Find Usages, Go to definition, Rename refactoring support.

Support custom language injections in heredoc (issue #17)

Added inspections in Terraform interpolations: incorrect use of 'self', 'unknown resource type', 'unresolved reference'

Added actions into 'Generate ...' popup. Use with alt+insert(ctrl+n on OSX)

0.4.4

Added 'deprecated parameter or block type' inspection.

Updated terraform model data to match Terraform 0.6.11

Minor internal refactoring

0.4.3

Updated terraform model data to match Terraform 0.6.8

0.4.2

Fix false 'unknown block' inspection result (issue #12)

Fix compatibility with non IDEA IDEs (issue #13)

0.4.1

Fix ClassCastException (issue #11)

0.4.0

Autocompletion in interpolations

Go to definition from interpolations to provider/resources properties, etc.

Find usages of provider/resources properties, etc. in interpolations

Inplace properties renaming (with usages tracking)

Previous changes see in sources repository