Skip to content

Helm Provider >=3.0.0 ignore KUBE_PROXY_URL environment variable #1653

@mathbruyen

Description

@mathbruyen

Terraform, Provider, Kubernetes and Helm Versions

Terraform v1.12.2
on linux_amd64
+ provider registry.terraform.io/hashicorp/helm v3.0.1

Affected Resource(s)

  • helm_release

Terraform Configuration Files

terraform {
  required_providers {
    helm = {
      source  = "hashicorp/helm"
      version = "3.0.1"
    }
  }
}

provider "helm" {
  kubernetes = {
    # proxy_url = "socks5://127.0.0.1:8443"
    host = var.cluster_endpoint
    cluster_ca_certificate = base64decode(var.cluster_ca_cert)
    exec = {
      api_version = "client.authentication.k8s.io/v1"
      args = ["eks", "get-token", "--cluster-name", var.cluster_name]
      command = "aws"
    }
  }
}

Expected Behavior

Running Terraform with

export KUBE_PROXY_URL=socks5://127.0.0.1:8443
terraform plan/apply/...

Should use the given proxy to reach Kubernetes API server.

Actual Behavior

Direct API calls to Kubernetes API server (resulting in I/O timeout since the API server cannot be reached without proxy).

Important Factoids

References

This appeared in the migration to Terraform plugin framework in helm/provider.go: b328cfa#diff-f9646891967ca129146e398bbf94d151e4c509a4e878f8deb0fde873da01f380

			"proxy_url": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "URL to the proxy to be used for all API requests",
				DefaultFunc: schema.EnvDefaultFunc("KUBE_PROXY_URL", ""),
			},

The new version looks up KUBE_PROXY environment variable instead.

	kubeProxy := os.Getenv("KUBE_PROXY")

Documentation in docs/index.md and templates/index.md.tmpl (visible on Terraform registry website) still refer to KUBE_PROXY_URL.

proxy_url behaves at previously (shown commented out in the configuration snippet)

I don't know if documentation needs to be fixed (and release note item added) or if the change is desired. Using KUBE_PROXY_URL means the same environment variable works for both Helm and Kubernetes providers.

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions