![]() ![]() ![]() 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. Why Formatting Your Terraform Manually with terraform fmt is not enough? ![]() You can also subscribe to our newsletter below to not miss any updates from us. In this post, you will learn to auto format terraform code in Visual Studio Code on save.ĭon’t want to miss any posts from us? join us on our Facebook group, and follow us on Facebook, Twitter, LinkedIn, and Instagram. However, nothing beats the comfort of getting your terraform code formatted on save in autopilot mode. Terraform has a command called terraform fmt that can format your code well. Terraform being our Infrastructure as Code tools use similar best practices as code. And better readability rewards us with other perks like easier-to-maintain code. How to Auto Format Terraform Code in Visual Studio Code on Saveįormatting your code makes it easier to read and understand for yourself and for your fellow co-workers who will collaborate on it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |