Using the nginx ingress chart for example, I am having troubles figuring out how to pass into the set argument of a helm_release, a list of annotations.
It would be great to see some more documentation, as lists are passed into help in a specific way but with terraform it's even trickier.
For example we keep getting this error:
helm_release.nginx-ingress-internal: rpc error: code = Unknown desc = YAML parse error on nginx-ingress/templates/controller-service.yaml: error unmarshaling JSON: json: cannot unmarshal object into Go struct field .annotations of type string
resource "helm_release" "nginx-ingress-internal" {
name = "${var.environment}-nginx-ingress-internal"
chart = "stable/nginx-ingress"
version = "0.19.0"
namespace = "${kubernetes_namespace.nginx.id}"
keyring = "" # disabled
set {
name = "controller.service.loadBalancerIP"
value = "${google_compute_address.nginx-ingress-internal.address}"
}
set {
name = "controller.service.externalTrafficPolicy"
value = "Local"
}
set {
name = "controller.service.annotations.cloud.google.com/load-balancer-type"
value = "Internal"
}
}
For a cloud.google.com/load-balancer-type: Internal annotation you need to escape the dots in the "cloud.google.com" namespace parts like so:
set {
name = "controller.service.annotations.cloud\\.google\\.com/load-balancer-type"
value = "Internal"
}
Otherwise it will be interpreted as this:
controller:
service:
annotations:
cloud:
google:
com/load-balancer-type: Internal
Thanks very much!
Most helpful comment
For a
cloud.google.com/load-balancer-type: Internalannotation you need to escape the dots in the "cloud.google.com" namespace parts like so:Otherwise it will be interpreted as this: