Step 2: Install HashiCorp Terraform Extention in VS Code Once, VS Code is installed, move to step 2 and we will be adding an extension. If not, just follow this official page to install it on your system. If you already have Visual Studio Code or VS Code installed in your system then move to the next step. Validate Format on Save Step 1: Install Visual Studio Code.Write some Terraform Code or Import Existing.Configure Terraform Auto Format in VS Code.Install HashiCorp Terraform Extention in VS Code.I am breaking down the steps and making it as simple as possible. Steps to Auto Format Terraform Code in Visual Studio Code on Save Your terraform code will be formatted automatically. However, what if you forget to run terraform fmt every time you write new terraform code? You will commit your file in version control and your terraform code will stay easier to read and maintain until you decide to change that.Īnd the best way to change that is to enable auto-format on save so that you don’t need to worry about it. Open your terraform project in a terminal. If you are not a very frequent user of terraform, it’s okay to just run the terraform fmt command and it formats your terraform file correctly. Subscribe Why Formatting Your Terraform Manually with terraform fmt is not enough?
0 Comments
Leave a Reply. |