Home > Back-end >  How to set up the same Terraform formatting style in VSCode and Intellij
How to set up the same Terraform formatting style in VSCode and Intellij

Time:01-07

I am setting up an environment to develop Terraform in VSCode.

I'm collaborating with another developer, who uses Intellij and I use VSCode.

enter image description here

The red part on the left is the code written in Intellij, and the green part on the right is the code written in VSCode.

I want to set the ESLint to be the same for each other to set a consistent format. How can I do that?

And I already set up setting.json

enter image description here

Now i use extension

HashiCorp Terraform https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform

Terraform (forked) https://marketplace.visualstudio.com/items?itemName=l2fprod.terraform-fork

Thanks a lot.

CodePudding user response:

The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style. This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability.

https://www.terraform.io/cli/commands/fmt

Rather than changing the formatting in your IDE's you should run the terraform fmt command which will format your code to correct formatting.

  •  Tags:  
  • Related