I have the following terraform:
The idea is that I can pass in volumes and either pass binary_data or data and this module will handle accordingly.
However it is not liking the nested loop. I have a feeling it's not liking iterating on the object.
When I run this I get the following error
#variable.tf
variable "volumes" {
type = map(object({
data = map(string)
binary_data = map(string)
}))
description = "configmap backed volume"
}
#main.tf
resource "kubernetes_config_map" "volume" {
for_each = var.volumes
metadata {
name = each.key
namespace = var.namespace
}
dynamic "data" {
for_each = each.value["data"]
content {
each.key = each.value
}
}
dynamic "binary_data" {
for_each = each.value["binary_data"]
content {
each.key = each.value
}
}
}
Error: Argument or block definition required
On ../../../terraform-modules/helm_install/main.tf line 45: An argument or block definition is required here. To set an argument, use the equals sign "=" to introduce the argument value.