Skip to content

Terraform Format

Terrateam Configuration Terrateam behavior can be configured via a config.yml. This file is located in a directory named .terrateam at the root of your Terraform repository: .terrateam/config.yml.

See Configuration documentation for details.

The terraform fmt command can be executed before a Plan operation using a custom Workflow.

terraform fmt

When a Plan operation runs, the exit status of terraform fmt against the changed files in the pull request can be used to determine the success or failure of the entire operation. This grants users the ability to enforce terraform fmt passing before running a terraform plan.

Terraform Fmt Plan Failure

Configuration

The Terrateam configuration file can be configured to execute terraform fmt with a custom workflow. Tags and Tag Queries can be used to target specific Dirspaces.

.terrateam/config.yml

workflows:
- tag_query: ""
plan:
- type: run
cmd: ['terraform', 'fmt', '-diff', '-check']
capture_output: true
- type: init
- type: plan

If a user were to initiate a pull request against the foo/bar/main.tf file then the Terrateam Plan operation would first execute terraform fmt -diff -check in the foo/bar/ directory. The entire Plan operation would fail if the terraform fmt command returns a non-zero exit code.

We use cookies and similar technologies to provide certain features, enhance the user experience and deliver content that is relevant to your interests. Depending on their purpose, analysis and marketing cookies may be used in addition to technically necessary cookies. By clicking on "Agree and continue", you declare your consent to the use of the aforementioned cookies. Here you can make detailed settings or revoke your consent (in part if necessary) with effect for the future. For further information, please refer to our Privacy Policy .