TFNFR25 - Verified Modules Requirements

ID: TFNFR25 - Category: Code Style - Verified Modules Requirements

The terraform.tf file MUST only contain one terraform block.

The first line of the terraform block MUST define a required_version property for the Terraform CLI. The standard Terraform TFLint plugin validates the requirement; MAPOTF keeps it first.

All AVM Terraform modules MUST require Terraform CLI 1.11.0 or later. The required_version property MUST include a minimum version constraint of at least 1.11.0. This baseline supports write-only arguments such as TFFR8’s ignore_body_changes and applies whether or not a module or consumer uses that feature. A module MAY require a later minimum version when needed.

The required_version property MUST include a constraint on the maximum major version of the Terraform CLI. Major version releases of the Terraform CLI can introduce breaking changes and MUST be tested.

The required_version property constraint SHOULD use the ~> #.# or the >= #.#.#, < #.#.# format.

Note: You can read more about Terraform version constraints in the documentation.

Example terraform.tf file:

terraform {
  required_version = ">= 1.11.0, < 2.0.0"
  required_providers {
    azapi = {
      source  = "Azure/azapi"
      version = "~> 2.12"
    }
  }
}

The AVM avm_terraform_configuration_file_required rule validates the complementary requirement that the module has exactly one terraform block in terraform.tf.