I also tried to declare a map of strings in different ways, including passing a YAML formatted map with <<YAML. Additionally, I rendered the map inside values by iterating through the Terraform map variable. However, nothing worked. The outcome is always the same: only the first line of the map is correctly indented.
Also:
variable "ebs_tags" {
type = map(string)
default = {
a = "one"
b = "two"
c = "three"
}
}
# https://github.com/kubernetes-sigs/aws-ebs-csi-driver
resource "helm_release" "ebs_csi_driver" {
count = var.enable_ebs_csi_driver ? 1 : 0
name = "aws-ebs-csi-driver"
namespace = "kube-system"
chart = "aws-ebs-csi-driver"
version = "2.35.1"
repository = "https://kubernetes-sigs.github.io/aws-ebs-csi-driver"
max_history = 5
set {
name = "controller.extraVolumeTags"
value = "${jsonencode(var.ebs_tags)}"
}
Results in:
│ Error: YAML parse error on aws-ebs-csi-driver/templates/controller.yaml: error converting YAML to JSON: yaml: line 81: did not find expected '-' indicator
│
│ with module.eks.helm_release.ebs_csi_driver[0],
│ on ../../k8s-system-aws-ebs-csi-driver.tf line 100, in resource "helm_release" "ebs_csi_driver":
│ 100: resource "helm_release" "ebs_csi_driver" {
│
Terraform, Provider, Kubernetes and Helm Versions
Affected Resource(s)
helm_release
Terraform Configuration Files
Debug Output
Steps to Reproduce
Declare a map of strings in terraform and pass it to helm_release.
Expected Behavior
Actual Behavior
Important Factoids
I also tried to declare a map of strings in different ways, including passing a YAML formatted map with <<YAML. Additionally, I rendered the map inside values by iterating through the Terraform map variable. However, nothing worked. The outcome is always the same: only the first line of the map is correctly indented. Also:
Results in:
And rendered as:
References
Helm template that renders extraVolumeTags dict.
Community Note