Terraform pass variables to a child module
James is correct but his syntax will work just for string variables. With others you have to specify the 'blank default':
variable "passed_list_var" {
default = []
}
variable "passed_map_var" {
default = {}
}
You need to declare any variables that a module uses at the module level itself:
variable "account_id" {
}
resource "aws_iam_policy_attachment" "myName" {
name = "myName"
policy_arn = "arn:aws:iam::${var.account_id}:policy/myName"
groups = []
users = []
roles = []
}