📜  helm providr (1)

📅  最后修改于: 2023-12-03 15:15:30.530000             🧑  作者: Mango

Helm Provider

Helm is a package manager for Kubernetes that streamlines the installation and management of applications on a Kubernetes cluster. Helm Providers allow you to create Kubernetes resources from within your Terraform configuration.

Prerequisites
Installation

To install the Helm Provider, run the following command:

terraform {
  required_providers {
    helm = {
      source = "hashicorp/helm"
      version = ">= 2.0.0"
    }
  }
}

provider "helm" {
  kubernetes {
    config_path = var.kube_config_path
  }
}
Usage
Installing a Helm Chart

To install a Helm chart, use the helm_release resource:

resource "helm_release" "nginx" {
  name       = "nginx"
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx"
}
Upgrading a Helm Release

To upgrade a Helm release, use the helm_release resource with the update_dependency argument:

resource "helm_release" "nginx" {
  name            = "nginx"
  repository      = "https://charts.bitnami.com/bitnami"
  chart           = "nginx"
  update_depency  = true
}
Deleting a Helm Release

To delete a Helm release, use the helm_release resource with the ensure_absent argument:

resource "helm_release" "nginx" {
  name            = "nginx"
  repository      = "https://charts.bitnami.com/bitnami"
  chart           = "nginx"
  ensure_absent   = true
}
Conclusion

In conclusion, the Helm Provider for Terraform allows you to manage Kubernetes resources through a declarative configuration. With the ability to install, upgrade, and delete Helm releases in your Terraform code, you can automate your Kubernetes deployment pipeline with ease.