Vscode-terraform: terraform fmt isn't called

Created on 16 Apr 2018  ·  10Comments  ·  Source: hashicorp/vscode-terraform

Hello,

I'm looking at the config, and I would expect that terraform fmt be run when I execute a save: command s on the Mac.

"terraform.format": { "enable": true, "ignoreExtensionsOnSave": [ ".tfsmurf" ], "formatOnSave": true },
I am using VS Code 1.22.2, plugin 0.0.23 of the plugin, and am running OSX 10.13.4, this was previously working, so I'm not sure why it stopped. I don't see any obvious mentions in the Console log or the Dev Tools. Nothing is registered when I execute command s. Running terraform fmt from bash does what I expect.

Most helpful comment

My extension seems to have been updated and experiencing the same issue. Here is my config, but I should just be able to use the default. Terraform should be in $PATH for VS Code, but I explicitly set it anyway. My files are correctly marked as Terraform and not HCL.

"terraform.format": {
    "enable": true,
    "formatOnSave": true
},
"terraform.path": "/usr/local/bin/terraform",

VSCode version 1.22.2, Terraform plugin version 1.0.3

All 10 comments

I'm seeing the same...after updating my preferences, setting the value to true, there's no format on save.

Visual Studio Code version 1.22.2
Commit 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
Date 2018-04-12T16:38:45.278Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

VS Terraform plug-in v1.02

what does terraform.path say in the configuration and where is terraform on your system?

I've also seen this a few days back, only to then notice that my Terraform files were set to the HCL language mode in the bottom bar, instead of Terraform. Once I switched them to Terraform it started to work as expected.

I hope this helps.

Very good callout, thank you. I will give that a check and report back.

My extension seems to have been updated and experiencing the same issue. Here is my config, but I should just be able to use the default. Terraform should be in $PATH for VS Code, but I explicitly set it anyway. My files are correctly marked as Terraform and not HCL.

"terraform.format": {
    "enable": true,
    "formatOnSave": true
},
"terraform.path": "/usr/local/bin/terraform",

VSCode version 1.22.2, Terraform plugin version 1.0.3

Do you have any relevant output in the “Output (Terraform)” tab?

Sent from my iPhone

On 30. Apr 2018, at 17:35, Daniel Adams notifications@github.com wrote:

My extension seems to have been updated and experiencing the same issue. Here is my config, but I should just be able to use the default. Terraform should be in $PATH for VS Code, but I explicitly set it anyway. My files are correctly marked as Terraform and not HCL.

"terraform.format": {
"enable": true,
"formatOnSave": true
},
"terraform.path": "/usr/local/bin/terraform",

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

No, nothing on any of the output selectors including Extensions and Extension Host. No Terraform output in the drop-down.

I'm experiencing the exact same issue as @danieladams456. Terraform.format is configured properly with terraform.path pointing directly to my terraform executable and no format on save as well as no output as well as no Terraform (Output) selector.

@mauve I am on version 1.0.4 now and format on save works. Since Terraform was in the path and I wasn't changing the formatting defaults, I was able to delete my extension config. I think we can probably close the issue now.

Cool. Thanks for using my plug-in.

Sent from my iPhone

On 1. May 2018, at 15:08, Daniel Adams notifications@github.com wrote:

@mauve I am on version 1.0.4 now and format on save works. Since Terraform was in the path and I wasn't changing the formatting defaults, I was able to delete my extension config. I think we can probably close the issue now.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renanaraujo picture renanaraujo  ·  5Comments

NeckBeardPrince picture NeckBeardPrince  ·  4Comments

LogicNinja picture LogicNinja  ·  3Comments

domenjesenovec picture domenjesenovec  ·  6Comments

jacobisaliveandwell picture jacobisaliveandwell  ·  3Comments