IntelliJ IDEA
 
Get IntelliJ IDEA
You are viewing the documentation for an earlier version of IntelliJ IDEA.

Terraform

Last modified: 09 May 2024

Terraform is an open-source tool that enables developers and operations teams to define, manage, and provision cloud resources and infrastructure components with code as opposed to manual configuration through a cloud provider's UI.

With it, you manage infrastructure resources, such as virtual machines, networks, and storage, in a declarative and automated manner. The replacement of manual configuration with codified templates ensures consistent and reproducible infrastructure setups.

IntelliJ IDEA provides the following features:

  • Syntax highlighting

    You can customize color settings in the Settings dialog (CtrlAlt0S) , on the Editor | Color Scheme | HCL and Editor | Color Scheme | HashiCorp Interpolation Language pages.

  • Code formatting

    You can access code style settings related to Terraform in the Settings dialog (CtrlAlt0S) on the Editor | Code Style | Terraform page.

  • Inspections

    You can detect duplicate, conflicting, deprecated, or missing elements, unresolved references, and more.

    Terraform missing property inspection

    You can check all Terraform inspections in the Settings dialog (CtrlAlt0S) under Editor | Inspections | Terraform.

  • Code completion

    This includes completion for known providers, resources, data sources, and arguments.

    Terraform resource completion
  • Code navigation

    Select a module or a variable and press Ctrl0B to navigate to its usages.

    Terraform find usages
  • Refactorings

    To rename the element and all its usages, press ShiftF6.

  • Structure view

    Use the Structure tool window to quickly preview and navigate Terraform files.

    Terraform Structure

    The tool window is available in View | Tool Windows | Structure or by pressing Alt07.

  • Quick documentation

    Hover over an argument to get quick documentation for it.

    Terraform quick documentation

    The window that pops up contains a link to Terraform Registry for more details. You can also open this link by pressing ShiftF1.

Coding assistance also includes brace matching CtrlShift0M, code folding CtrlNumPad +/CtrlNumPad -, adding line comments Ctrl0/ and block comments CtrlShift0/.