Convert Figma logo to code with AI

hashicorp logoterraform-provider-helm

Terraform Helm provider

1,004
374
1,004
113

Top Related Projects

26,898

The Kubernetes Package Manager

111,715

Production-Grade Container Scheduling and Management

22,042

Pulumi - Infrastructure as Code in any programming language 🚀

63,384

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.

Terraform Kubernetes provider

6,459

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.

Quick Overview

The terraform-provider-helm is a Terraform provider for managing Helm charts in Kubernetes clusters. It allows users to deploy, upgrade, and manage Helm releases using Terraform, enabling infrastructure-as-code practices for Kubernetes applications.

Pros

  • Seamless integration of Helm charts with Terraform workflows
  • Provides version control and reproducibility for Helm deployments
  • Supports both Helm 2 and Helm 3
  • Allows for easy management of multiple Helm releases across different environments

Cons

  • Limited support for some advanced Helm features
  • May require additional setup and configuration compared to using Helm CLI directly
  • Learning curve for users not familiar with both Terraform and Helm
  • Potential performance overhead when managing many releases

Code Examples

  1. Basic Helm release deployment:
resource "helm_release" "example" {
  name       = "my-redis-release"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "redis"
  version    = "17.3.14"

  set {
    name  = "cluster.enabled"
    value = "true"
  }
}
  1. Helm release with values file:
resource "helm_release" "example" {
  name       = "my-nginx-release"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx"
  version    = "13.2.24"

  values = [
    file("${path.module}/values.yaml")
  ]
}
  1. Helm release with multiple set values:
resource "helm_release" "example" {
  name       = "my-wordpress-release"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "wordpress"
  version    = "15.2.35"

  set {
    name  = "wordpressUsername"
    value = "admin"
  }

  set {
    name  = "wordpressPassword"
    value = var.wordpress_password
  }

  set {
    name  = "mariadb.auth.rootPassword"
    value = var.mariadb_root_password
  }
}

Getting Started

  1. Add the Helm provider to your Terraform configuration:
terraform {
  required_providers {
    helm = {
      source  = "hashicorp/helm"
      version = "~> 2.9.0"
    }
  }
}

provider "helm" {
  kubernetes {
    config_path = "~/.kube/config"
  }
}
  1. Define a Helm release resource:
resource "helm_release" "example" {
  name       = "my-release"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx"
  version    = "13.2.24"
}
  1. Run terraform init to initialize the provider, then terraform apply to deploy the Helm release.

Competitor Comparisons

26,898

The Kubernetes Package Manager

Pros of Helm

  • Native Kubernetes package manager with a rich ecosystem of charts
  • Supports complex deployments with templating and value overrides
  • Provides direct CLI interaction for managing releases

Cons of Helm

  • Requires separate installation and management outside of Terraform
  • Less integrated with overall infrastructure-as-code workflows
  • May lead to divergence between Helm state and Terraform state

Code Comparison

Helm CLI:

helm install my-release bitnami/wordpress
helm upgrade my-release bitnami/wordpress --set persistence.size=10Gi

Terraform Provider for Helm:

resource "helm_release" "wordpress" {
  name       = "my-release"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "wordpress"
  set {
    name  = "persistence.size"
    value = "10Gi"
  }
}

The Helm CLI offers direct interaction with Kubernetes clusters, while the Terraform Provider for Helm integrates Helm deployments into Terraform workflows. The Helm CLI provides more flexibility for ad-hoc operations, whereas the Terraform Provider ensures consistency with other infrastructure components and enables version-controlled deployments.

111,715

Production-Grade Container Scheduling and Management

Pros of Kubernetes

  • Comprehensive container orchestration platform with extensive features
  • Large, active community and ecosystem
  • Native support for scaling, load balancing, and self-healing

Cons of Kubernetes

  • Steeper learning curve and more complex setup
  • Requires more resources to run and manage
  • May be overkill for smaller projects or simpler deployments

Code Comparison

Kubernetes manifest (YAML):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Terraform-provider-helm (HCL):

resource "helm_release" "nginx" {
  name       = "nginx"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx"
  version    = "9.5.0"

  set {
    name  = "replicaCount"
    value = "3"
  }
}

The Kubernetes manifest directly defines a Deployment, while the Terraform-provider-helm code uses Helm to deploy a chart. The Helm approach abstracts away some complexity but may offer less fine-grained control compared to raw Kubernetes manifests.

22,042

Pulumi - Infrastructure as Code in any programming language 🚀

Pros of Pulumi

  • Supports multiple programming languages (Python, TypeScript, Go, etc.), offering more flexibility than Terraform's HCL
  • Provides stronger type checking and IDE support due to using general-purpose languages
  • Offers more advanced programming constructs like loops, conditionals, and functions out-of-the-box

Cons of Pulumi

  • Steeper learning curve for users not familiar with the chosen programming language
  • Smaller ecosystem and community compared to Terraform's extensive provider network
  • Potentially more complex setup and configuration process

Code Comparison

Pulumi (Python):

import pulumi
from pulumi_kubernetes.helm.v3 import Chart, ChartOpts

nginx = Chart("nginx",
    ChartOpts(
        chart="nginx",
        version="9.5.13",
        fetch_opts={"repo": "https://charts.bitnami.com/bitnami"}
    )
)

Terraform (HCL):

resource "helm_release" "nginx" {
  name       = "nginx"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx"
  version    = "9.5.13"
}

Both examples deploy an Nginx chart using Helm, but Pulumi uses Python while Terraform uses HCL. Pulumi's approach allows for more complex logic and reusability, while Terraform's syntax is more declarative and potentially easier to read for simple deployments.

63,384

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.

Pros of Ansible

  • Broader scope for general IT automation and configuration management
  • Agentless architecture, requiring only SSH access to managed nodes
  • Large community and extensive module ecosystem

Cons of Ansible

  • Steeper learning curve for complex tasks compared to Terraform's declarative approach
  • Less focused on infrastructure provisioning and management
  • Potential performance issues with large-scale deployments

Code Comparison

Ansible playbook example:

- name: Install Nginx
  hosts: webservers
  tasks:
    - name: Ensure Nginx is installed
      apt:
        name: nginx
        state: present
    - name: Start Nginx service
      service:
        name: nginx
        state: started

Terraform with Helm provider example:

resource "helm_release" "nginx_ingress" {
  name       = "nginx-ingress"
  repository = "https://kubernetes.github.io/ingress-nginx"
  chart      = "ingress-nginx"
  namespace  = "ingress-nginx"
}

The Ansible playbook demonstrates a more imperative approach to configuration management, while the Terraform code showcases a declarative method for deploying Kubernetes resources using Helm charts. Ansible offers more flexibility for general IT tasks, while Terraform with the Helm provider is more specialized for Kubernetes and cloud infrastructure management.

Terraform Kubernetes provider

Pros of terraform-provider-kubernetes

  • More comprehensive coverage of Kubernetes resources
  • Direct interaction with Kubernetes API, allowing for fine-grained control
  • Better suited for complex Kubernetes configurations and custom resources

Cons of terraform-provider-kubernetes

  • Steeper learning curve, especially for those unfamiliar with Kubernetes internals
  • Requires more detailed configuration for each resource
  • May require more frequent updates to keep pace with Kubernetes API changes

Code Comparison

terraform-provider-kubernetes:

resource "kubernetes_deployment" "example" {
  metadata {
    name = "example-deployment"
    labels = {
      app = "example"
    }
  }
  spec {
    replicas = 3
    selector {
      match_labels = {
        app = "example"
      }
    }
    template {
      metadata {
        labels = {
          app = "example"
        }
      }
      spec {
        container {
          image = "nginx:1.7.8"
          name  = "example"
        }
      }
    }
  }
}

terraform-provider-helm:

resource "helm_release" "example" {
  name       = "example-release"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx"
  version    = "9.5.0"

  set {
    name  = "replicaCount"
    value = "3"
  }
}

The terraform-provider-kubernetes example shows more detailed configuration, while the terraform-provider-helm example is more concise, leveraging pre-configured Helm charts.

6,459

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.

Pros of Flux2

  • Native GitOps approach for continuous delivery
  • Supports multi-tenancy and multi-cluster deployments
  • Built-in support for Helm charts and Kustomize

Cons of Flux2

  • Steeper learning curve for users new to GitOps
  • Less flexibility in managing individual Helm releases
  • Requires additional setup for integration with existing CI/CD pipelines

Code Comparison

Terraform-provider-helm:

resource "helm_release" "example" {
  name       = "my-redis"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "redis"
  version    = "12.7.4"
}

Flux2:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: redis
  namespace: default
spec:
  chart:
    spec:
      chart: redis
      version: 12.7.4
      sourceRef:
        kind: HelmRepository
        name: bitnami
        namespace: flux-system

The Terraform-provider-helm allows for direct management of Helm releases within Terraform, while Flux2 uses a declarative approach with custom resources in Kubernetes. Flux2 provides a more comprehensive GitOps solution, but Terraform-provider-helm offers tighter integration with existing Terraform workflows.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Terraform logo

Helm Provider for Terraform Actions StatusGitHub tag (latest SemVer)licenseGo Report Card

This is the Helm provider for Terraform.

This provider allows you to install and manage Helm Charts in your Kubernetes cluster using Terraform.

Contents

Requirements

  • Terraform v0.12.x
  • Go v1.18.x (to build the provider plugin)

Getting Started

This is a small example of how to install the nginx ingress controller chart. Please read the documentation for more information.

provider "helm" {
  kubernetes {
    config_path = "~/.kube/config"
  }
}

resource "helm_release" "nginx_ingress" {
  name       = "nginx-ingress-controller"

  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx-ingress-controller"

  set {
    name  = "service.type"
    value = "ClusterIP"
  }
}

Contributing

The Helm Provider for Terraform is the work of many contributors. We appreciate your help!

To contribute, please read the contribution guidelines. You may also report an issue. Once you've filed an issue, it will follow the issue lifecycle.

Also available are some answers to Frequently Asked Questions.