Module Variables


Variables in Terraform allow modules to take the input. Since modules are similar to procedures in programming languages, they take the input, return an output, and change the state of resources.

Variables provide the mechanism for inputs to be given and for the outputs to be returned to the consumer of the module. Variables are a critical aspect of Terraform modules.

A simple module variable

We’ve created a directory named ltthw_variable/variable_module and then changed the directory to ltthw_variables/variable_module. Now we’ll create a file and write the following content in it:

Get hands-on with 1200+ tech skills courses.