At work lately, I have been working with Terraform for our Infrastructure-as-code. My limited domain expertise lies primarily within the scope of backend systems. I had never worked with provisioning infrastructure via code before. So it was a valuable experience to see code turn on machines to execute more code.
Here are a few things I learnt during the process:
- Use
tfswitch
for dependency management to install and toggle between the various Terraform versions used across the modules. - Always use
terraform init --upgrade
to never use cached modules. This saves a lot of potential trouble shooting at the cost of few seconds. - Use
terraform plan -var='key:value'
whenever we have to use variables (for example, passwords).