Ask questionsterraform fmt on save not actually occurring

If have Format on Save enabled, and on saving a .tf file, the output shows it running terraform fmt on the file:

2019-03-29 15:15:41:274 [INFO ] formatting-provider: running 'terraform fmt' on 'c:\Users\user\project-dir\'
2019-03-29 15:15:41:275 [INFO ] runner: Running terraform cwd='C:\Users\user\AppData\Local\Programs\Microsoft VS Code' path='terraform' (version: 0.11.11) args=[fmt, -]
2019-03-29 15:15:42:492 [INFO ] file-system-watcher: Indexed file:///c%3A/Users/user/project-dir/
2019-03-29 15:15:44:340 [INFO ] runner: Running terraform succeeded.

However, the formatting is not applied and file remains unchanged.

Running terraform fmt on the file via the console has the expected formatting effect on the file.

This issue was also mentioned by @IronFarm in


Answer questions udondan

Can't figure it out... I just replaced the - now with document.fileName. Certainly not the way to do it and sometimes causes issues with vsc complaining the file it wants to save is newer than what it got. Better though than not formatting the code.

BTW, manually formatting the code works. It's only the format on save that doesn't do anything, event though the function is triggered and debugging output looks as if it worked.

PS: How do i have version 1.4.0 installed when the latest release here is 1.3.12?


Related questions

Terraform v0.12.3 - Syntax check broken: Unknown token IDENT hot 2
feat: Terraform 0.12 support (was hcl2 support) hot 1
terraform.tfvars An argument named "xxx" is not expected here. hot 1
feat: Terraform 0.12 support (was hcl2 support) hot 1
Valid use of "resource for_each" in configuration causes VS Code peek problem hot 1
Terraform 0.12 linting also breaks formatting? hot 1
Installing language server errors when terraform is not found - vscode-terraform hot 1
Github User Rank List