I am doing the following in my terraform
module:
data "vault_policy_document" "this" {
dynamic "rule" {
for_each = {
for p in var.policy.policy_content : format("%s-%s-%s", p.path, join(",", p.capabilities)) => p
}
content {
path = rule.value.path
capabilities = rule.value.capabilities
}
}
}
The variable is declared as
variable "policy" {
description = "The policy to be created"
type = map(any)
}
and with a certain confidence, it is of the form
{
+ "policy-test-1" = {
+ policy_content = [
+ {
+ capabilities = [
+ "read",
+ "create",
]
+ path = "/foo/lala"
},
+ {
+ capabilities = [
+ "read",
+ "create",
]
+ path = "/bar/lala"
},
]
}
},
Is there a way to access the values of policy_content
in my for
loop?