hashicorp / terraform-provider-helm

Terraform Helm provider
https://www.terraform.io/docs/providers/helm/
Mozilla Public License 2.0
997 stars 369 forks source link

Passing a map to the set value #713

Closed iaacautomation closed 3 years ago

iaacautomation commented 3 years ago

Terraform, Provider, Kubernetes and Helm Versions

Terraform v0.13.6


### Affected Resource(s)
- helm_release

<!--If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.-->

### Terraform Configuration Files
```hcl
resource "helm_release" "aws_load_balancer_controller" {
  depends_on              = [kubernetes_service_account.aws_load_balancer_controller]
  name                    = "eks"
  repository              = "https://aws.github.io/eks-charts"
  namespace               = "kube-system"
  chart                   = "aws-load-balancer-controller"
  version                 = "v1.1.5"
  set {
    name                  = "serviceAccount.create"
    value                 = "false"
  }
  set {
    name                  = "serviceAccount.name"
    value                 = "aws-load-balancer-controller"
  }
  set {
    name                  = "clusterName"
    value                 = var.cluster_name
  }
  set {
    name                  = "enableShield"
    value                 = var.enable_shield
  }
  set {
    name                  = "enableWafv2"
    value                 = var.enable_wafv2
  }
  set {
    name                  = "defaultTags"
    value                 = jsonencode(var.tags)
  }
  set {
    name                  = "nodeSelector"
    value                 = jsonencode({
  "node.kubernetes.io/lifecycle"  : "normal"
}
    type                  = "string"
  }
}

Debug Output

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

Expected Behavior

Set nodeSelector metadata to "node.kubernetes.io/lifecycle" : "normal"

Actual Behavior

Error: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.nodeSelector): invalid type for io.k8s.api.core.v1.PodSpec.nodeSelector: got "array", expected "map"

on ../../terraform-kubernetes-aws-eks/alb_controller.tf line 9, in resource "helm_release" "aws_load_balancer_controller": 9: resource "helm_release" "aws_load_balancer_controller" {

Important Factoids

EKS Version :1.18 chart : aws-alb-balancer-controller Use 2 types of nodes, ondemand with lifecycle = normal and spot for lifecycle=spot Since this is a essential service it needs to run on normal lifecycle

Exactly same problem occurs with tags since defaultTags is supposed to be a map. So there should be a way of specifiying maps as input instead of just strings.

ghost commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!