4

I need to be able to generate disposable kubernetes environments using terraform. These environments should use helm for application deployment and ideally have tiller installed during the terraform resource provision.

What is the best way of automating this? Should I "copy" the deployment generated by helm init and translate it to terraform lingo? Is there any other solution more elegant than this?

I tried to explicitly declare the terraform's helm provider block, but without any real chart deployment it does not bother into installing the tiller service.

3
  • helm provider should install tiler by default, but in order to use helm repository data source, there's a need to run helm init which installs tiller :( I'm not sure how to force provider to install tiller before you do helm init
    – holms
    Apr 2, 2019 at 1:57
  • You can actually perform a helm init without installing tiller by adding the flag --client-only.
    – Navarro
    Apr 9, 2019 at 10:53
  • I prefer using something like "helm template | kubectl apply -f -" until tiller becomes tillerless in the next version.
    – Robert
    Jul 13, 2019 at 11:48

2 Answers 2

1

How I see there is two options (from my exp):

  1. Use configuration for provider. https://www.terraform.io/docs/providers/helm/index.html, there is option to install tiller.
  2. Use prefabricated modules, for example: https://github.com/sagikazarmark/terraform-tiller https://registry.terraform.io/modules/Vidimensional/tiller/kubernetes/0.0.1
0

I think this is achieveable with terraforms null_resource (https://www.terraform.io/docs/providers/null/resource.html) with local-exec.

Example (untested):

resource "null_resource" "helm_init_command" {

  provisioner "local-exec" {
    command = "helm --kubeconfig=<...> init"

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.