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

Pseudo-Diffs when using helm_release #749

Closed
maxgr0 opened this issue May 22, 2021 · 2 comments
Closed

Pseudo-Diffs when using helm_release #749

maxgr0 opened this issue May 22, 2021 · 2 comments

Comments

@maxgr0
Copy link

maxgr0 commented May 22, 2021

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: 0.15.3
Provider version: 2.1.2
Kubernetes version: 2.2.0

Affected Resource(s)

  • helm_release

Terraform Configuration Files

resource "helm_release" "alb_controller" {
  name       = "alb-controller"
  repository = "https://aws.github.io/eks-charts"
  chart      = "aws-load-balancer-controller"
  version    = "1.2.0"
  namespace  = "kube-system"
  atomic     = true
  timeout    = 900
  set {
    name  = "clusterName"
    value = var.k8s_cluster_name
  }
  set {
    name  = "rbac.create"
    value = "true"
  }
  set {
    name  = "serviceAccount.create"
    value = "true"
  }
  set {
    name  = "serviceAccount.name"
    value = "alb-controller"
  }
  set {
    name  = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
    value = module.alb_controller_k8s_iam_connection.iam_role_arn
  }
  set {
    name  = "region"
    value = data.aws_arn.k8s_cluster.region
  }
  set {
    name  = "vpcId"
    value = var.k8s_cluster_vpc_id
  }
  set {
    name  = "enableWafv2"
    value = "true"
  }
  set {
    name  = "enableWaf"
    value = "true"
  }
  depends_on = [
    module.alb_controller_k8s_iam_connection,
    module.k8s_cluster_healthz
  ]
}

Steps to Reproduce

  1. terraform apply

Expected Behavior

The provider should recognize that nothing has changed in the configuration.

Actual Behavior

The values set using set produce a pseudo difference:

  # module.main_applications.helm_release.alb_controller will be updated in-place
  ~ resource "helm_release" "alb_controller" {
        id                         = "alb-controller"
        name                       = "alb-controller"
        # (26 unchanged attributes hidden)

      - set {
          - name  = "enableWaf" -> null
          - value = "true" -> null
        }
      + set {
          + name  = "enableWaf"
          + value = "true"
        }
      - set {
          - name  = "enableWafv2" -> null
          - value = "true" -> null
        }
      + set {
          + name  = "enableWafv2"
          + value = "true"
        }

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
@eytanhanig
Copy link

IIRC, adding type = "string" in the set block fixed this for us, however we eventually decided to use values = with a template instead of the problematic set option. This has the added benefit of type preservation.

To help make your diffs easier to read I recommend removing and line breaks and comments after rendering the template. Here's an example for doing this::

locals {
  match_comment    = "/(?U)(?m)(?s)(^[[:blank:]]*#.*$)/"
  match_empty_line = "/(?m)(?s)(^[\r\n])/"
}

resource "helm_release" "example" {
  # Other helm_release stuff here

  values = [replace(replace(templatefile("${path.module}/values.yaml.tftpl", {
    list_parameter   = ["foo", "bar"]
    string_parameter = "hello world"
  }), local.match_comment, ""), local.match_empty_line, "")]
}

@github-actions
Copy link

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!

@github-actions github-actions bot added the stale label Jul 15, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 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