0

I am calling a terraform module from my main.tf as follows:

module "vpc" {
  source                  = "./modules/vpc"
  match_pub_ip_env_vpc_sn = true
  env_vpc_sg_name         = "My name"
  env_vpc_sg_desc         = "My description"
}

My question is this: Can I use a file to populate the call to the above module with the values I want for the above variables without explicitly adding them in the module statement (as above). If so is there a file naming convention that terraform uses for such a purpose? (i.e. without me needing to pass -vars-file in the cmd?)

1 Answer 1

1

Unfortunately not. It's like a method/function call. The module needs to declare what variables it takes (eg the signature or parameter list in a programming language, with some being defaulted if not set) and then the caller of the module needs to pass any required variables when it declares the module.

Sign up to request clarification or add additional context in comments.

1 Comment

I guess that is the problem that terragrunt is trying to solve, right?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.