Provision an EKS Cluster and Helm Chart install in the same TF environment!

Hello from an excited newbie to using terraform. At the company I am working at I am changing the install method to based on terraform. Right now we have two modules - one for provisioning the EKS cluster and the other for Helm installing our kubernetes cluster.

We want to try to combine the two into one root module. So that users who install with terraform don’t need to terraform apply in two separate directories, and can clean up with a single terraform destroy. I have two questions:

  1. Is this a good idea to have a single environment? (since all the tutorials I’ve seen provision two environments, so it seems TF is not meant for this)

  2. Practically any advice on how to do it? The issue is passing in the kubeconfig credentials of the newly created cluster into the helm and kubernetes providers to authenticate . It seems that depends_on does not work with providers, and only with resources.

Would highly appreciate any help/newbie enlightenment from the community.


Yes, this is the key issue which makes it impossible. Since Terraform operations are strictly divided into plan and apply, and you can’t plan using the later providers until the earlier ones have applied, this is why it needs to be two separate Terraform configurations.

1 Like