Terraform-provider-helm: how do i run "helm init" with this provider?

Created on 30 May 2018  路  11Comments  路  Source: hashicorp/terraform-provider-helm

Anyway to run something similar to helm init using this provider with terraform or no way to to this?

thanks

Most helpful comment

there is workaround

resource "null_resource" "helm_init" {
  provisioner "local-exec" {
    command = "echo \"$(terraform output kube_config)\" > ./azurek8s"
  }
  provisioner "local-exec" {
    command = "export KUBECONFIG=./azurek8s"
  }
  provisioner "local-exec" {
    command = "helm init"
    environment {
      KUBECONFIG = "./azurek8s"
    }
  }
}

All 11 comments

I think it should be possible to run the equivalent of helm init -c using the Helm library at every run because, unless I'm wrong, this process is idempotent.

there is workaround

resource "null_resource" "helm_init" {
  provisioner "local-exec" {
    command = "echo \"$(terraform output kube_config)\" > ./azurek8s"
  }
  provisioner "local-exec" {
    command = "export KUBECONFIG=./azurek8s"
  }
  provisioner "local-exec" {
    command = "helm init"
    environment {
      KUBECONFIG = "./azurek8s"
    }
  }
}

@mkyc Thanks for sharing the workaround snippet.

Is this still the recommended method to run helm init?

I'm still lost how to do this @mkyc was downvoted for a reason, its not clear what all that kube_config copying is doing.

helm init does a client and a server initialisation. Server initialisation means installing the tiller, which is covered. Client initialisation is not yet there, but it will be fixed with #185

Support for helm initialization was released with v0.10.0 of the helm provider.

Closing this as both client and server initialisation are covered

@rporres when helm provider will execute the "helm init"? I'm asking this because I would like to just execute it without install any helm file. I was though that only the provider declaration was sufficient, but it seems not working. So, I've just added a dummy helm_repository data source to force the refresh. Doesn't works as well...

Initialization is done silent and turned on by default

Since helm_repository deals with local directories, you will get client initialized if you use that but you will need a release to force the provider to install tiller to communicate with server

@rporres could you tell us at what stage the initialization is done? I have an external data resource to query helm however helm doesn't seem to be initialized (.helm does not exist) when the script runs.

Was this page helpful?
0 / 5 - 0 ratings