JetBrains Fleet 1.44 Help

Terraform

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.

Basic Terraform support

With Smart Mode off, JetBrains Fleet recognizes Terraform configuration and variable definition (.tf and .tfvars) files and provides basic highlighting, brace matching, code folding, and comments toggling inside them.

Fold a code block

  • Point at the gutter near a code block. This reveals arrows, which you can use to fold or unfold the respective code block.

    Arrows appear upon pointing at the gutter near a foldable code block

Comment code

  • To comment a line, press ⌘ /. This will comment the line at the caret.

  • To comment a code block, select the code you want to comment and press ⌘ ⌥ /.

Terraform support in Smart Mode

In Smart Mode, JetBrains Fleet provides the following additional features:

  • Enhanced highlighting, reflecting additional information, such as if a link can be resolved.

  • Go to definition ⌘ B

  • Context-aware code completion

  • Usage count for declarations

  • Reformat code ⌥ ⇧ F (requires Terraform to be installed)

Enable Smart Mode

  • Click the Smart Mode Status icon in the top-right corner. In the popup that appears, click Enable.

    Enabling Smart Mode

You may have to wait for preparatory activities to complete. If you want to disable Smart Mode later on, you can do it through the same popup.

Terraform settings

The list below describes the settings that you can use to adjust Terraform support in JetBrains Fleet. For more information about managing settings, refer to Settings.

terraform-ls.experimentalFeatures.validateOnSave

Enabling this feature will run terraform validate within the folder of the file saved.

Type: boolean

Default value: false

terraform-ls.ignoreSingleFileWarning

This setting controls whether terraform-ls sends a warning about opening up a single Terraform file instead of a Terraform folder. Setting this to `true` will prevent the message being sent.

Type: boolean

Default value: false

terraform-ls.indexing.ignoreDirectoryNames

This allows excluding directories from being indexed upon initialization by passing a list of directory names. The following list of directories will always be ignored: `.git`, `.fleet`, `.idea`, `.vscode`, `terraform.tfstate.d`, `.terragrunt-cache`.

Type: string[]

Default value: []

terraform-ls.indexing.ignorePaths

Paths to ignore when indexing the workspace on initialization. This can serve as an escape hatch in large workspaces. Key side effect of ignoring a path is that go-to-definition, go-to-references and generally most IntelliSense related to local `module` blocks will not work until the target module code is explicitly opened. Relative paths are resolved relative to the root (workspace) path opened in the editor. Path separators are converted automatically to the match separators of the target platform (e.g. `\` on Windows, or `/` on Unix), symlinks are followed, trailing slashes automatically removed, and `~` is replaced with your home directory.

Type: string[]

Default value: []

terraform-ls.terraform.logFilePath

Path to a file for Terraform executions to be logged into (`TF_LOG_PATH`) with support for variables (e.g. Timestamp, Pid, Ppid) via Go template syntax `{{.VarName}}`

Type: string

Default value: ""

terraform-ls.terraform.path

Path to the Terraform binary. This is usually looked up automatically from `PATH` and should not need to be specified in majority of cases. Use this to override the automatic lookup.

Type: string

Default value: ""

terraform-ls.terraform.timeout

Overrides Terraform execution timeout in https://pkg.go.dev/time#ParseDuration compatible format (e.g. `30s`).

Type: string

Default value: ""

Last modified: 12 December 2024