I am trying to create IAM binding for Bigquery dataset using the resource - google_bigquery_dataset_iam_binding. The requirement is I read the parameters in this resource (dataset_id, role, members) using a variable of the following structure -
bq_iam_role_bindings = {
"member1" = {
"dataset1" : ["role1","role2", "role5"],
"dataset2" : ["role3","role2"],
},
"member2" = {
"dataset3" : ["role1","role4"],
"dataset2" : ["role5"],
}
}
So, I need to loop over this variable and get the roles assigned on a dataset for each member. Here total resources created would be eight (for each member, each dataset and each role). I am new to terraform and understand only how to apply simple for loop over a map and for_each loop in a resource. Want to understand how is it possible what I am trying to do.
This is the nearest what I have found - Map within a map in terraform variables where I can read the value in a nested map but I need to extract key also in my case. Can anyone help here please.
flatten
the result and then use that result infor_each
. – Easygoing{member="something" dataset_id="some_data" role="some_role"}
– Easygoing