terraform.mk

tf-format

Synopsis: make tf-format

Hooks: tf-pre-format, tf-post-format, tf-format-target

Variables:

Variable

Description

TERRAFORM_RUNNER

<terraform executor> - defaults to ‘terraform’, but could pass something like terragrunt

TF_LINT_TARGETS

<file or directory path to Terraform code> - defaults to empty and searches for modules

TERRAFORM_SWITCHES_FOR_FMT

<switches to pass to terraform fmt> - defaults to ‘-diff -recursive’

TERRAFORM_VARS_BEFORE_FMT

<env variables to pass to Terraform when calling fmt> - defaults to empty

Reformat project Terraform code in the given directories/files using terraform’s fmt tool.

tf-lint

Synopsis: make tf-lint

Hooks: tf-pre-lint, tf-post-lint, tf-lint-target

Variables:

Variable

Description

TERRAFORM_RUNNER

<terraform executor> - defaults to ‘terraform’, but could pass something like terragrunt

TF_LINT_TARGETS

<file or directory path to Terraform code> - defaults to empty and searches for modules

TERRAFORM_SWITCHES_FOR_FMT

<switches to pass to terraform fmt> - defaults to ‘-diff -recursive’

TERRAFORM_VARS_BEFORE_FMT

<env variables to pass to Terraform when calling fmt> - defaults to empty

TERRAFORM_LINT_VARS_BEFORE_INIT

env variables to pass to Terraform when calling init> - defaults to empty

TERRAFORM_LINT_SWITCHES_FOR_INIT

<switches to pass to terraform fmt> - defaults to ‘-backend=false -compact-warnings’

TERRAFORM_LINT_VARS_BEFORE_VALIDATE

env variables to pass to Terraform when calling validate> - defaults to empty

TERRAFORM_LINT_SWITCHES_FOR_VALIDATE

<switches to pass to terraform fmt> - defaults to ‘-compact-warnings’

TERRAFORM_TFLINT_RUNNER

<tflint executor> - defaults to ‘tflint’

TERRAFORM_VARS_BEFORE_TFLINT

<env variables to pass to tflint> - defaults to empty

TERRAFORM_SWITCHES_FOR_TFLINT

<switches to pass to terraform fmt> - defaults to empty

Lint Terraform code in the given directories/files using fmt and tflint.