-
Notifications
You must be signed in to change notification settings - Fork 407
Closed
Description
Terraform Version
0.12.19
Affected Resource(s)
- helm_release
Terraform Configuration Files
locals {
kubeconfig = <<KUBECONFIG
apiVersion: v1
clusters:
- cluster:
server: ${aws_eks_cluster.my_cluster.endpoint}
certificate-authority-data: ${aws_eks_cluster.my_cluster.certificate_authority.0.data}
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: aws
name: aws
current-context: aws
kind: Config
preferences: {}
users:
- name: aws
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
command: aws-iam-authenticator
args:
- "token"
- "-i"
- "${aws_eks_cluster.my_cluster.name}"
KUBECONFIG
}
resource "local_file" "kubeconfig" {
content = local.kubeconfig
filename = "/home/terraform/.kube/config"
}
resource "null_resource" "custom" {
depends_on = [local_file.kubeconfig]
# change trigger to run every time
triggers = {
build_number = "${timestamp()}"
}
# download kubectl
provisioner "local-exec" {
command = <<EOF
set -e
curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/aws-iam-authenticator
chmod +x aws-iam-authenticator
mkdir -p $HOME/bin && cp ./aws-iam-authenticator $HOME/bin/aws-iam-authenticator && export PATH=$PATH:$HOME/bin
echo $PATH
aws-iam-authenticator
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x kubectl
./kubectl get po
EOF
}
}
resource "helm_release" "testchart" {
depends_on = [local_file.kubeconfig]
name = "testchart"
chart = "../../../resources/testchart"
namespace = "default"
}Debug Output
Note that
kubectl get poreaches the cluster and reports "No resources found in default namespace."- while helm_release reports: "Error: Kubernetes cluster unreachable"
- In earlier testing it errored with "Error: stat /home/terraform/.kube/config". Now that I write the local file to that location, it no longer errors. I assume that means it successfully reads the kube config.
https://gist.github.com/eeeschwartz/021c7b0ca66a1b102970f36c42b23a59
Expected Behavior
The testchart is applied
Actual Behavior
The helm provider is unable to reach the EKS cluster.
Steps to Reproduce
On terraform.io:
terraform apply
Important Factoids
Note that kubectl is able to communicate with the cluster. But something about the terraform.io environment, the .helm/config, or the helm provider itself renders the cluster unreachable.
Note of Gratitude
Thanks for all the work getting helm 3 support out the door. Holler if I'm missing anything obvious or can help diagnose further.
Smuggla, wilsncc, mlauke, kwahsog, stefankuksenko and 1 more