fix: adjust code for root policy document to generate blocks instead of map of lists
All checks were successful
development / Check commit compliance (push) Successful in 6s
pull-requests-open / Check commit compliance (pull_request) Successful in 30s

This commit is contained in:
Bertrand Lanson 2024-05-29 23:09:53 +02:00
parent d28fe5c099
commit 7b337f47f5
Signed by: lanson
SSH Key Fingerprint: SHA256:/nqc6HGqld/PS208F6FUOvZlUzTS0rGpNNwR5O2bQBw

52
root.tf
View File

@ -24,18 +24,56 @@ locals {
root_policy_rules = merge(local.root_policy_default_rules, var.root_policy_extra_rules)
}
# data "vault_policy_document" "root" {
# dynamic "rule" {
# for_each = local.root_policy_rules
# content {
# path = each.value.path
# capabilities = each.value.capabilities
# description = try(each.value.description, null)
# required_parameters = try(each.value.required_parameters, null)
# allowed_parameter = try(each.value.allowed_parameter, null)
# denied_parameter = try(each.value.denied_parameter, null)
# min_wrapping_ttl = try(each.value.min_wrapping_ttl, null)
# max_wrapping_ttl = try(each.value.max_wrapping_ttl, null)
# }
# }
# }
data "vault_policy_document" "root" {
dynamic "rule" {
for_each = local.root_policy_rules
content {
path = each.value.path
capabilities = each.value.capabilities
description = try(each.value.description, null)
path = rule.value.path
capabilities = rule.value.capabilities
description = try(rule.value.description, null)
min_wrapping_ttl = try(rule.value.min_wrapping_ttl, null)
max_wrapping_ttl = try(rule.value.max_wrapping_ttl, null)
required_parameters = try(each.value.required_parameters, null)
allowed_parameter = try(each.value.allowed_parameter, null)
denied_parameter = try(each.value.denied_parameter, null)
min_wrapping_ttl = try(each.value.min_wrapping_ttl, null)
max_wrapping_ttl = try(each.value.max_wrapping_ttl, null)
# dynamic "required_parameters" {
# for_each = rule.value.required_parameters != null ? rule.value.required_parameters : {}
# content {
# key = required_parameters.key
# value = required_parameters.value
# }
# }
dynamic "allowed_parameter" {
for_each = rule.value.allowed_parameter != null ? rule.value.allowed_parameter : {}
content {
key = allowed_parameter.key
value = allowed_parameter.value
}
}
dynamic "denied_parameter" {
for_each = rule.value.denied_parameter != null ? rule.value.denied_parameter : {}
content {
key = denied_parameter.key
value = denied_parameter.value
}
}
}
}
}