Nebulaworks Insight Content Card Background - Erik eastman shanghai architecture
Terraform & Vim Plugin Basics
If you’ve been starting to write Terraform configuration inside of
vim then here are a
few tips of what you should enable to make life simpler when working with those *.tf files.
Taken directly from the vim-terraform git repo: Installation is as simple
as cloning the repo if you are leveraging
cd ~/.vim/bundle git clone https://github.com/hashivim/vim-terraform.git
Note: If you prefer to use something besides pathogen, go ahead.
The most immediate change you should notice without any additional configuration is that syntax highlighting is now
enabled! If you want to set up a specific olorscheme for *.tf’s then specify it as follows (this assumes the
icansee is already installed):
autocmd BufEnter *.tf* colorscheme icansee
Terraform has a command called terraform fmt which is the canonical
format and style for *.tf files. What’s really slick is
vim-terraform allows automatically running
when saving *.tf and/or *.tfvars files. Its as simple as adding the following to your existing
terraform fmt I would recommend adding the override for indentation to your
.vimrc. This overrides the
indentation level to 2 spaces to conform to the hashicorp style:
Note: Make sure you have a recent clone of the plugin since there was a bug in Sept which effected this option.
This should give you a very nice and consistent configuration to be able to work with
terraform inside of vim. Happy
Looking for a partner with engineering prowess? We got you.
Learn how we've helped companies like yours.