terraform-provider-helm
terraform-provider-helm copied to clipboard
Can't use set { value = "true" }
Terraform, Provider, Kubernetes and Helm Versions
Terraform version: 1.1.9
Provider version: 2.3.0
Kubernetes version: 1.19
Affected Resource(s)
- helm_release
Terraform Configuration Files
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
I'm trying to install metrics-server and add 2 labels to the service one of them having the value = "true" error:
terrafrom code
module "metrics-server" {
source = "terraform-module/release/helm"
version = "2.7.0"
namespace = "kube-system"
repository = "https://kubernetes-sigs.github.io/metrics-server/"
app = {
name = "metrics-server"
version = "3.8.2"
chart = "metrics-server"
force_update = true
wait = false
recreate_pods = false
deploy = 1
}
set = [
{
name = "service.labels.kubernetes\\.io/name"
value = "Metrics-server"
},
{
name = "service.labels.kubernetes\\.io/cluster-service"
value = "true"
}
]
}
**Error:** unable to build kubernetes objects from release manifest: unable to decode "": resource.metadataOnlyObject.ObjectMeta: v1.ObjectMeta.Labels: ReadString: expects " or n, but found t, error found in #10 byte of ...|service":true,"kuber|..., bigger context ...|cs-server-3.8.2","kubernetes.io/cluster-service":true,"kubernetes.io/name":"Metrics-server"},"name":|...
Debug Output
NOTE: In addition to Terraform debugging, please set HELM_DEBUG=1 to enable debugging info from helm.
Panic Output
Steps to Reproduce
terraform apply -target module.mindlinc.module.metrics-server
Expected Behavior
Create a metrics-server with lables added
Actual Behavior
Error: unable to build kubernetes objects from release manifest: unable to decode "": resource.metadataOnlyObject.ObjectMeta: v1.ObjectMeta.Labels: ReadString: expects " or n, but found t, error found in #10 byte of ...|service":true,"kuber|..., bigger context ...|cs-server-3.8.2","kubernetes.io/cluster-service":true,"kubernetes.io/name":"Metrics-server"},"name":|...
│
│ with module.mindlinc.module.metrics-server.helm_release.this[0],
│ on .terraform/modules/mindlinc.metrics-server/main.tf line 1, in resource "helm_release" "this":
│ 1: resource "helm_release" "this" {
Important Factoids
Running in EKS
References
- GH-1234
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
Try setting the type = "string in the set block here. I think what's happening is that it's defaulting to auto and assuming you want to set a boolean value in the yaml – but because it's a label you're modifying it needs to be the string "true"
@jrhouston Tried that. Did not work. It's like it takes true without quotes. Any other word will take as string, not true though.
Oh! I just realized you're using the the terraform-module/release/helm terraform module, which wraps the helm provider. I can see in their code their set input doesn't actually implement the type attribute:
https://github.com/terraform-module/terraform-helm-release/blob/master/variables.tf#L17-L24
So you'll need to open an issue with them (or open a PR against their repo to add it).