Supplying variables to modules

Is there some way to provide variable values to my modules besides supplying them in my module {} section of the root main.tf file? That would make for a very large and ugly file.

I tried putting a terraform.tfvars file in the modules/module directory but that doesn’t work.

The end goal is to manage the variables for each module independently.

Thanks.

Hi

I think you can certainly write beautiful Terraform code but as far as I know there is a single terraform.tfvars (assigns values to the variables) and I kind of like it as there is a place to have all the configuration together.

Please see an example with modules and variables that uses many different files and with variable definitions in its own module (i.e. aws_sg_rds_mariadb_default_vars.tf)

Let me me know what you think about the layout and proposed best practices.