terraform block
The top-level block that configures Terraform itself rather than any infrastructure, such as its required version, providers and backend.
In more detail
It holds required_version, required_providers and the backend block. Only constant values are allowed inside it, because Terraform reads it before evaluating anything else.
Example
terraform {
required_version = ">= 1.6.0"
}Related terms
- required_version — The setting in the terraform block that says which Terraform versions may run this configuration.
- required_providers — The block inside the terraform block that lists each provider a configuration needs, where to download it from and which versions are acceptable.
- Terraform backend — The setting that decides where Terraform stores state and how it locks it, from a local file to shared cloud storage.
Taught in
- Installing Terraform And Meeting The CLI — Infrastructure as Code with Terraform
- Providers And The required_providers Block — Infrastructure as Code with Terraform
- Writing Your First Configuration In HCL — Infrastructure as Code with Terraform
- The Problem With Local State — Infrastructure as Code with Terraform
- Providers: How Terraform Reaches Every API — HashiCorp Terraform Associate (004) Exam Prep
- Remote State With The Backend Block — HashiCorp Terraform Associate (004) Exam Prep
- Runs In HCP Terraform: The cloud Block And Remote Execution — HashiCorp Terraform Associate (004) Exam Prep