In my terragrunt.hcl
file I pass few variables to a module - one of them is map and list
terraform {
source = "git@github.com:<my_account>/infrastructure-modules.git//iam?ref=v.0.0.9"
}
include {
path = find_in_parent_folders()
}
inputs = {
var_1 = "string"
var_2 = {
object1 = {
val1 : "a",
val2 : "b"
},
object2 = {
val3 : "c",
val4 : "d"
}
}
but when I pass it to a module
resource "google_project_iam_binding" "members" {
for_each = var.var2
project = var.project_name
role = "projects/${var.project_name}/roles/${each.key}"
members = each.value
}
it doesn't understand it and see it as a string
Error: Invalid for_each argument
on main.tf line 34, in resource "google_project_iam_binding" "members":
34: for_each = var.var2
The given "for_each" argument value is unsuitable: the "for_each" argument
must be a map, or set of strings, and you have provided a value of type
string.
anyone have any thoughts on what might be the issue ?