Skip to content

helm_release_set not working when environment_variables are set #64

Description

@mcandio

I have the following helm_release_set resource:

resource "helmfile_release_set" "external-dns" {
  working_directory = "${path.module}/helmfiles/external-dns"
  kubeconfig        = pathexpand("~/.kube/config")
  environment_variables = local.external_dns_environment_variables
  depends_on = [
    aws_iam_openid_connect_provider.cluster,
    module.eks_iam_role
  ]
}

locals {
  external_dns_environment_variables = { 
    "KUBECTX"               = "var.context"
    "EKS_ROLE_ARN"          = "${module.eks_iam_role.service_account_role_arn}"
  }
}

and this is my helmfile.yaml:

---
repositories:
  - name: external-dns
    url: https://kubernetes-sigs.github.io/external-dns/

helmDefaults:
  wait: true
  timeout: 120
  atomic: false
  createNamespace: true
  kubeContext: {{ requiredEnv "KUBECTX" }}

releases:
  - name: external-dns
    namespace: kube-system
    chart: external-dns/external-dns
    values:

      - serviceAccount:
          create: true
          annotations: {
             eks.amazonaws.com/role-arn: {{ requiredEnv "EKS_ROLE_ARN" }},
            }
          name: "external-dns"

        rbac:
          create: true
        podAnnotations: {
          eks.amazonaws.com/role-arn: {{ requiredEnv "EKS_ROLE_ARN" }},
        }

        service:
          port: 7979

        logLevel: info
        logFormat: text

        interval: 1m
        triggerLoopOnEvent: false

        sources:
          - service
          - ingress

        policy: upsert-only

        registry: txt
        txtOwnerId: "external-dns"
        txtPrefix: "external-dns"

        provider: aws

        extraArgs: [
          --aws-zone-type=public
          ]

The fact is that I'm using this your provider since a long time ago but now it's not working, the resource seems to fail when the diff can't evaluate the requiredEnv, but, funny thing is var.context is already set.
If the previous resources are created, the diff goes well, but the strange thing is var.context not working now.

this is the error that I'm getting:

│ Error: diffing release set: running helmfile diff: running command: /usr/local/bin/helmfile: exit status 1
│ in ./helmfile.yaml: error during helmfile.yaml.part.0 parsing: template: stringTemplate:11:18: executing "stringTemplate" at <requiredEnv "KUBECTX">: error calling requiredEnv: required env var `KUBECTX` is not set
│ 
│ 
│   on external-dns.tf line 1, in resource "helmfile_release_set" "external-dns":
│    1: resource "helmfile_release_set" "external-dns" {

I don't understand what could be wrong.
I really use this provider a lot, any thoughts here?

Thanks mumoshu for this excellent provider.

I have read that I can specify the kubeconfig to "" but this is not how it was working.

Hope someone can help me, really lost here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions