DEV Community

S3CloudHub
S3CloudHub

Posted on

How to Use Variables | Interpolation and Condition method in Terraform

IMAGE ALT TEXT HERE

Input Variables
Hands-on: Try the Customize Terraform Configuration with Variables tutorial.

Input variables let you customize aspects of Terraform modules without altering the module's own source code. This functionality allows you to share modules across different Terraform configurations, making your module composable and reusable.

When you declare variables in the root module of your configuration, you can set their values using CLI options and environment variables. When you declare them in child modules, the calling module should pass values in the module block.

If you're familiar with traditional programming languages, it can be useful to compare Terraform modules to function definitions:

Input variables are like function arguments.
Output values are like function return values.
Local values are like a function's temporary local variables.

Top comments (0)