Source: lambdafunc.medium.com

Terraform basics: Variables
There are multiple ways to use variables in TF. Variables are like passing arguments to programme.

Define a variable as shown in line 9: and then call it in line 20: Now, you have 2 options to pass values: Or better, we can pass value as below: Third option is preferred way to do this.

A more glorified example would for variables where you can use environment variable to define multiple environments.

Since we hav e changed file name from default, we need to pass on custom file name as var-file.

Related Articles