Question about visual studio editor default spacing in .tf files

Hi all,
I’m using this extension and I really like it:

Anyway I don’t know if this is because of my default settings or from this extension but when formatting my code it’s automatically setting the default identation/tab to 2 spaces.
I do have it like this by default before but it was not applying to .tf files.
Now with this plugin it does, which is fine by me, but my colleagues rather use 4 spaces so I was wondering any idea how can I configure this?
I took a look at the readme and the configurations but could not find it.

Thanks for any feedback

Hi @cstmgl
What you described (two spaces) is the intended behavior of terraform fmt along with other behaviours around positioning of = (equal sign), aligning of expressions or attributes etc.

As with all of the terraform fmt formatting decisions, this is a subjective and therefore essentially arbitrary decision based on tradeoffs made by the original implementer, and it’s unlikely to change because that would cause changes for everyone who had previously formatted examples like this with terraform fmt in earlier versions. The bar for changes to existing terraform fmt layout behaviors is very high, and would typically need to have a strong and objective (rather than subjective) justification to warrant causing diffs for all existing Terraform configurations after upgrading.

For convenience and for pragmatic reasons we recommend all users to follow the conventions implied by terraform fmt. Relatedly we do not plan to allow users of the extension to customize this behaviour. It is possible however that behaviour of terraform fmt may change between Terraform versions.

If you wish, you can turn off auto-formatting via VS Code settings:

"[terraform]": {
  "editor.formatOnSave": false,
"[terraform-vars]": {
  "editor.formatOnSave": false,
1 Like

thank you for the feedback, I was thinking this was some problem on my side but is good to know this is “per design” I will adjust. thank you