Not planned
Description
Terraform Version and Provider Version
Terraform v0.12.29
+ provider.helm v1.3.2
Provider Version
+ provider.helm v1.3.2
Affected Resource(s)
- helm_release
Terraform Configuration Files
set {
name = "podAnnotations.ad\\.datadoghq\\.com/velero\\.instances"
type = "string"
value = "[{\"metrics\":[\"velero*\"],\"namespace\":\"velero\",\"prometheus_url\":\"http://%%host%%:8085/metrics\"}]"
}
Debug Output
module.velero_backup.helm_release.velero: Modifying... [id=velero]
Error: failed parsing key "podAnnotations.ad\\.datadoghq\\.com/velero\\.instances" with value '[{"prometheus_url": "http://%%host%%:8085/metrics", "namespace": "velero", "metrics": ["velero*"]}]', key " \"namespace\": \"velero\"" has no value (cannot end with ,)
Expected Behavior
Provider should only use value as string and not try to parse it.
Workaround
Replace comma like in #330 (comment)
References
- How can a JSON file's content be passed as a value to helm? #435
- setting value with comma, crashes provider #330 (comment)
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Activity
jrhouston commentedon Nov 18, 2020
Thanks for opening this @jfcoz. This looks like a problem with the strvals package that Helm provides – we just call through to that package to parse the set operations in the the format of
key=value
that is used on the CLI.I was able to reproduce this on the helm cli too:
mlapish commentedon Nov 19, 2020
I have the same issue as this trying to set a json string for backend-config on service for google ingress. I found putting a space in the front of the string allows it to be accepted and doesn't impact the annotation.
set {
type = "auto"
name = "controller.service.annotations.beta\.cloud\.google\.com/backend-config"
# this has space because of provider bug and how it treats json
# #618
# luckily it doens't seem to have negative impact on ingress creation
# having a space in the annotation
value = " {"ports": {"443": "cloud-armor-${var.ingress_class_suffix}-backend-config"}}"
}
kaskavalci commentedon May 4, 2021
Issue #669 also concerns the same problem. Just adding here for linking to the active issue with a workaround.
koalalorenzo commentedon May 27, 2021
I have found the same issue trying to set a JSON. adding a space does not work anymore :(
villesau commentedon Aug 12, 2021
Neither adding space or #330 (comment) works for me. In our case the value is sensitive so setting as values is not an optimal workaround either.
E: Actually, when I use both workarounds together it goes trough:
value = " ${replace(file("${path.root}/some-json.json"), ",", "\\,")}"
dev-ago commentedon Oct 25, 2021
Unfortunately I have the same problem, has anyone here already found a solution?
github-actions commentedon Nov 15, 2022
Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!
villesau commentedon Nov 15, 2022
Still valid.
eoneoff commentedon Feb 3, 2023
Still valid.
There are two problems here: the one with the braces (used to pass the lists), which can be resolved by initial space or escaping the braces and the one with comma (which is used to pass multiple values at once), which can be resolved by escaping the comma. In my case
saved the day.
The problem is that such behavior is caused by helm, giving an option to pass a collection or multiple values as a command line parameter. It is supposed to be so and even is described in the The Format Limitations of --set documentation section. I can propose, that
type="string"
could have not just convert the values to string, but automatically escape the curly braces and commas.5 remaining items