This Terraform module provides a flexible way to install Helm charts on a Kubernetes cluster. It uses a null_resource
with a local-exec
provisioner to run Helm commands, allowing for dynamic chart installation and updates.
- Installs or upgrades Helm charts
- Supports custom repositories
- Allows for namespace creation
- Configurable chart values
- Uses temporary files for secure kubeconfig and values handling
- Terraform >= 0.13
- Helm (installed on the machine running Terraform)
- Access to a Kubernetes cluster
Name | Description | Type | Default | Required |
---|---|---|---|---|
chart_name |
Name of the Helm chart to install | string |
n/a | yes |
chart_version |
Version of the Helm chart to install | string |
n/a | yes |
release_name |
Name for the Helm release | string |
n/a | yes |
namespace |
Kubernetes namespace to install the release into | string |
n/a | yes |
create_namespace |
Whether to create the namespace if it doesn't exist | bool |
false |
no |
repo_name |
Name of the Helm repository | string |
n/a | yes |
repo_url |
URL of the Helm repository | string |
n/a | yes |
cluster_ca_certificate |
Base64 encoded CA certificate of the Kubernetes cluster | string |
n/a | yes |
cluster_endpoint |
Endpoint of the Kubernetes cluster | string |
n/a | yes |
token |
Authentication token for the Kubernetes cluster | string |
n/a | yes |
set_values |
Map of values to pass to the Helm chart | any |
{} |
no |
- The module creates temporary files for the kubeconfig and chart values.
- It then uses these temporary files to run Helm commands via a
local-exec
provisioner. - The Helm repository is added and updated.
- The chart is installed or upgraded using the provided values.
- Temporary files are cleaned up after the Helm command execution.
- Ensure that the machine running Terraform has Helm installed and configured.
- The module uses a
null_resource
with alocal-exec
provisioner, which means the Helm commands are executed on the machine running Terraform, not within Terraform itself. - Be cautious with sensitive information in
set_values
. While this module uses temporary files, it's generally a good practice to manage secrets separately.
Contributions to improve this module are welcome. Please submit a pull request or open an issue on the repository.
This module is released under the MIT License. See the LICENSE file for more details.
Name | Version |
---|---|
terraform | >= 0.13.0 |
null | >= 3.0.0 |
Name | Version |
---|---|
null | >= 3.0.0 |
No modules.
Name | Type |
---|---|
null_resource.helm_install | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
always_update | Set this to true value trigger a Helm chart update | bool |
false |
no |
chart_name | Name of the chart | string |
n/a | yes |
chart_version | Version of the chart | string |
n/a | yes |
create_namespace | Create the namespace if it does not exist. Defaults to false | bool |
false |
no |
kubeconfig_json | Kubeconfig JSON | string |
n/a | yes |
namespace | Namespace to install the chart | string |
n/a | yes |
release_name | Release name of the chart | string |
n/a | yes |
repo_name | Name of the Helm repository | string |
n/a | yes |
repo_url | URL of the Helm repository | string |
n/a | yes |
set_values | A map of values to pass to the Helm chart | any |
{} |
no |
No outputs.