Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use set { value = "true" } #864

Closed
mihaidf22 opened this issue May 17, 2022 · 3 comments
Closed

Can't use set { value = "true" } #864

mihaidf22 opened this issue May 17, 2022 · 3 comments

Comments

@mihaidf22
Copy link

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

Gist - url

NOTE: In addition to Terraform debugging, please set HELM_DEBUG=1 to enable debugging info from helm.

Panic Output

Steps to Reproduce

  1. 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

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
@mihaidf22 mihaidf22 added the bug label May 17, 2022
@jrhouston
Copy link
Contributor

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"

@mihaidf22
Copy link
Author

@jrhouston Tried that. Did not work. It's like it takes true without quotes. Any other word will take as string, not true though.

@jrhouston
Copy link
Contributor

jrhouston commented Jun 16, 2022

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).

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants