Repository: aws-ia/terraform-aws-eks-blueprints

Issue #942: Unable to `set` some boolean values on addon Helm configuration
Created: 2022-09-09T10:36:10Z
Description
I'm unable to set the prometheus.io/scrape flag on the cluster-autoscaler deployment using the cluster_autoscaler addon using the set pattern. [1]
Applying this Terraform:
module "eks_blueprints_kubernetes_addons" {
  source = "github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons?ref=v4.8.1"

  eks_cluster_id       = var.eks_cluster_id
  eks_cluster_endpoint = var.eks_cluster_endpoint
  eks_oidc_provider    = var.oidc_provider
  eks_cluster_version  = var.eks_cluster_version

  enable_cluster_autoscaler           = true
  cluster_autoscaler_helm_config = {
    set = [
      {
        name = "podLabels.prometheus\\.io/scrape",
        value = "true",
      }
    ]
  }
}
Results in the error:
│ Error: failed to create resource: Deployment in version "v1" cannot be handled as a Deployment: json: cannot unmarshal bool into Go struct field LabelSelector.spec.selector.matchLabels of type string
│
│   with module.eks_blueprints_kubernetes_addons.module.cluster_autoscaler[0].module.helm_addon.helm_release.addon[0],
│   on .terraform/modules/eks_blueprints_kubernetes_addons/modules/kubernetes-addons/helm-addon/main.tf line 1, in resource "helm_release" "addon":
│    1: resource "helm_release" "addon" {
│

While I haven't tested other addons, I suspect they will suffer from the same problem.
[1] It would be possible to pass in the configuration using values rather than set, but this then hits aws-ia/terraform-aws-eks-blueprints-addons#38.

 ✋ I have searched the open/closed issues and my issue is not listed.

⚠️ Note
Before you submit an issue, please perform the following first:

Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
Re-initialize the project root to pull down modules: terraform init
Re-attempt your terraform plan or apply and check if the issue still persists

Versions

Module version [Required]: 4.8.1
Terraform version: v1.2.8
Provider version(s):


provider registry.terraform.io/gavinbunney/kubectl v1.14.0
provider registry.terraform.io/hashicorp/aws v4.29.0
provider registry.terraform.io/hashicorp/helm v2.6.0
provider registry.terraform.io/hashicorp/kubernetes v2.13.1
provider registry.terraform.io/hashicorp/time v0.8.0

Reproduction Code [Required]
Steps to reproduce the behavior:
Provision an EKS cluster with cluster-autoscaler with the Helm config set to:
cluster_autoscaler_helm_config = {
    set = [
      {
        name = "podLabels.prometheus\\.io/scrape",
        value = "true",
      }
    ]
  }
Expected behaviour
There should be a mechanism to set values that Kuebrnetes expect to be string but Go/HCL forces them to be a boolean or number.
Actual behaviour
Terraform fails to apply the changes and returns the error:
│ Error: failed to create resource: Deployment in version "v1" cannot be handled as a Deployment: json: cannot unmarshal bool into Go struct field LabelSelector.spec.selector.matchLabels of type string
│
│   with module.eks_blueprints_kubernetes_addons.module.cluster_autoscaler[0].module.helm_addon.helm_release.addon[0],
│   on .terraform/modules/eks_blueprints_kubernetes_addons/modules/kubernetes-addons/helm-addon/main.tf line 1, in resource "helm_release" "addon":
│    1: resource "helm_release" "addon" {
│

Terminal Output Screenshot(s)

Additional context

Duplicate issue #975: [Teams]Creating an application team for an existing namespace
Created: 2022-09-20T11:32:38Z
✋ I have searched the open/closed issues and my issue is not listed.

Please describe your question here
I have an existing namespace that I would like to create an application team for. As far as I can tell there is no way to opt out of namespace creation for this module, but I also don't want to recreate the namespace.
Do you know of any workarounds for this?

Closing comment (2023-01-10T17:17:05Z): Did you link the wrong issue @bryantbiggs - not sure I understand how this is related to #942