Curated articles, resources, tips and trends from the DevOps World.
 
                                            Summary: This is a summary of an article originally published by the source. Read the full original article here →
                    When starting out with Terraform it’s hard to know what is considered ‘best practice’ in a number of areas. This post is the sixth in the series which focuses on point 6 in the list, ‘Avoid hardcoding variables’, and also shows best practice for general variable use in Terraform. 
 Here's an example of a variables.tf file in the root module (root directory) of a project that is used to create a Windows desktop VM in Azure: Note that every variable has a description. 
 Lastly the files in the vm module itself, firstly the variables.tf file: Again note that defaults can be set for variables, these are taken if no value is passed in. In this case, I always want the following to apply as default unless a value is specified: These variables are also missing their descriptions! 
 You’ll see that the SKU description under source image reference is described as the following: These variables are then used by the module code in main.tf
                
Made with pure grit © 2025 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com