Skip to content

Polyconseil/terraform-provider-helm

 
 

Repository files navigation

Terraform Provider for Helm Build Status GitHub tag (latest SemVer) license

This is a Helm provider for Terraform.

The provider manages the installed Charts in your Kubernetes cluster, in the same way of Helm does, through Terraform. It will also install Tiller automatically if it is not already present.

Contents

Developing the Provider

Installation from sources

If you wish to compile the provider from source code, you'll first need Go installed on your machine (version >=1.9 is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-helm

> mkdir -p $GOPATH/src/github.com/terraform-providers
> git clone https://github.com/terraform-providers/terraform-provider-helm.git $GOPATH/src/github.com/terraform-providers/terraform-provider-helm

Enter the provider directory and build the provider

> cd $GOPATH/src/github.com/terraform-providers/terraform-provider-helm
> make build

Now copy the compiled binary to the Terraform's plugins folder, if is your first plugin maybe isn't present.

> mkdir -p ~/.terraform.d/plugins/
> mv terraform-provider-helm ~/.terraform.d/plugins/

Example

This is a small example of how to install the mariadb chart on your default kubernetes cluster, since the provider was initialized, all the configuration is retrieved from the environment. Please read the documentation for more information.

You should have a local configured copy of kubectl.

resource "helm_release" "my_database" {
    name      = "my-database"
    chart     = "stable/mariadb"

    set {
        name  = "mariadbUser"
        value = "foo"
    }

    set {
        name = "mariadbPassword"
        value = "qux"
    }

    set_string {
        name = "image.tags"
        value = "registry\\.io/terraform-provider-helm\\,example\\.io/terraform-provider-helm"
    }
}

License

Mozilla Public License 2.0, see LICENSE