I looked similar issues in other threads but dont seem to identify what mistake i am doing here.
I have a working code to create DMS resources in aws, which I put it together in DMS_module folder to make it root module.
Now after doing terraform init, when I run terraform plan from my child module in DMS_deploy_module.tf, it gives me error saying undeclared variables.
Error:
I declared all the 15 variables in variables.tf in my root module directory and still the error. Sorry this could be a novice error, since this is my first terraform module attempt.
My assumption here is, once we declare the variables in root module, we dont have to declare them again in child module and we simply use it in child module.
Thanks
I can see that you have created a variables.tf file for the module itself, but not on your "root" path where you are trying to call the module. Currently you are trying to access a variables.tf that does not exist, so you should follow something like:
However I would try to avoid using variables when calling this module if possible, as it might cause confusion and you are using variables to set another variables set in the module. Sounds kind of redundant.
Hope my answer helps you!