HomeRoadmapsTerraform Day 11
Kubernetes & GitOps Track Β· Day 11 Β· 20 min

Helm Chart Automation
DevOps IaC Part 2 β€” Day 11

Package and release ingress controllers, cert-manager, and services via the HashiCorp Helm provider

πŸ› οΈ Tooling: Terraform 1.5+, HashiCorp Helm Provider & Helm 3🎭 Role: Kubernetes & Cloud Infrastructure Quality Architect
KubernetesHelmPackage ManagementIngress ControllerRelease AutomationIaC
About Today's 20-Minute Lab

While custom applications are frequently defined with the kubernetes provider, third-party platform infrastructure (Ingress Controllers, Redis caches, Prometheus monitoring, Cert-Manager) is packaged as Helm charts. Managing Helm releases through Terraform via the HashiCorp Helm Provider combines the breadth of the Kubernetes packaging ecosystem with the state locking, dependency tracking, and parameterization of Terraform IaC.

🎬
Day 11 Video Walkthrough: Helm Chart Lifecycle & Release Automation with TerraformComing Soon

An interactive 20 min video walkthrough for Day 11 is currently in production. Follow the step-by-step interactive playbook below!

πŸ“¦Sample Codebase & Working Solution (Day 11)Available Now
View on GitHub

The official reference codebase for Day 11 is hosted in the repository. Clone the repository and navigate to day-11-helm-automation to run the working solution.

Git Clone β€” Working Solution
git clone https://github.com/777abhi/devops-terraform-roadmap.git
cd devops-terraform-roadmap/day-11-helm-automation
1

Architecture: Helm Provider vs Standalone Helm CLI

Understand how Terraform tracks Helm release metadata and provides atomic rollbacks.

The Lifecycle Integration Architecture

Examine how the Helm provider interacts directly with the Kubernetes API to manage release secrets.

helm-provider-architecture.txt
Helm Provider Operational Flow:
1. Provider config reads cluster kubeconfig / token.
2. Terraform computes diff between declared 'set' / 'values' and existing release state.
3. If delta detected:
   - Queries Helm repository for chart version.
   - Generates templated manifests.
   - Executes atomic upgrade against cluster API.
   - If health check fails within timeout -> triggers automated rollback.
2

Declaring helm_release in HCL

Configure provider and declare an Ingress-Nginx or Bitnami Redis release with custom values.

Configure Helm Provider in versions.tf

Declare provider requirements and cluster authentication.

HCL β€” versions.tf
# versions.tf
terraform {
  required_version = ">= 1.5.0"
  required_providers {
    helm = {
      source  = "hashicorp/helm"
      version = "~> 2.13.0"
    }
  }
}

provider "helm" {
  kubernetes {
    config_path    = "~/.kube/config"
    config_context = "kind-devops-lab-cluster"
  }
}
Author main.tf with helm_release

Provision Ingress Nginx Controller with atomic guarantees and values overrides.

HCL β€” main.tf
# main.tf
resource "helm_release" "ingress_nginx" {
  name             = "ingress-nginx"
  repository       = "https://kubernetes.github.io/ingress-nginx"
  chart            = "ingress-nginx"
  version          = "4.10.0"
  namespace        = "ingress-system"
  create_namespace = true

  # Guarantees rollback if deployment does not become ready
  atomic  = true
  timeout = 300

  set {
    name  = "controller.service.type"
    value = "NodePort"
  }

  set {
    name  = "controller.service.nodePorts.http"
    value = "30080"
  }

  set {
    name  = "controller.replicaCount"
    value = "2"
  }
}

output "release_status" {
  value       = helm_release.ingress_nginx.status
  description = "Status of the deployed Helm release"
}
3

Execution & Release History Verification

Deploy the Helm release via Terraform and audit installed objects using kubectl.

Initialize and Apply Helm Release

Run terraform apply to download the chart and orchestrate the release.

Terminal β€” Apply Helm Release
cd /Users/abhinavsharma/Downloads/devops-terraform-roadmap/day-11-helm-automation
terraform init
terraform apply -auto-approve
Verify Release Objects

Confirm that pods and services were created in the ingress-system namespace.

Terminal β€” Verify Helm Objects
kubectl get pods -n ingress-system
kubectl get svc -n ingress-system
4

Production Governance & CRD Lifecycle

Navigate Helm version pinning, values file structure, and Custom Resource Definitions.

🏭CRD Handling & Helm Value Hierarchy

1. Mandatory Chart Version Pinning: Always pin the exact version attribute in helm_release. Never omit the version or use latest, as upstream breaking changes could destabilize production on the next pipeline trigger.

2. CRD Upgrades: Helm does not automatically upgrade Custom Resource Definitions (CRDs) across chart version bumps by design. For charts with complex CRDs (like Cert-Manager or Prometheus Operator), manage CRDs with standalone kubernetes_manifest resources or dedicated pre-install hooks.

Day 11 Quality Gate & Outcomes Checklist
  • Understood the role of Helm charts in provisioning third-party platform infrastructure.
  • Configured the official HashiCorp Helm provider against the local Kind cluster.
  • Declared helm_release with explicit chart version pinning and parameter overrides.
  • Enforced atomic deployment guarantees (atomic = true) and timeout thresholds.
  • Verified deployed pods and services in dedicated namespaces via kubectl.