Loading...
Loading...
The command [terraform fmt](https://github.com/hashicorp/terraform/blob/d71f0c6149e64b14554f4a36a8273bd6b6234074/command/fmt.go) does not check the 'required_version'. This can lead to formatting that is incompatible with the 'required_version'. All `terraform` commands which read/touch the files should use the [version_required.go:CheckCoreVersionRequirements](/hashicorp/terraform/blob/main/terraform/version_required.go) function. ---- ### Terraform Version ``` $ terraform version Terraform v0.15.1 on darwin_amd64 ``` ### Terraform Configuration Files ```terraform terraform { required_version = "= 0.14.11" } ``` ### Expected Behavior `terraform fmt` should perform the 'version_required' check. ### Actual Behavior `terraform fmt` does not perform the 'version_required' check. It proceeds even if the current terraform version is now allowed. ### Steps to Reproduce ```sh ## specify the required version mkdir bug-terraform-fmt-version-required cd $_ echo 'terraform { required_version = "= 0.14.11" }' > versions.tf ## ensure you are on the latest release (0.15.1) terraform version ## execute `init`: observe that it does a version check terraform init ## execute `fmt`: observe that it does not do a version check terraform fmt ``` ### References - https://github.com/hashicorp/terraform/blob/d71f0c6149e64b14554f4a36a8273bd6b6234074/command/fmt.go - https://github.com/hashicorp/terraform/blob/c98f352dc81ed11547364e5665a47993eb09a138/terraform/version_required.go
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.