DEV Community

leroykayanda
leroykayanda

Posted on

Installing a helm chart in EKS using terraform

data.tf

data "aws_eks_cluster" "cluster" {
  name = "${var.env}-${var.cluster_name}"
}

data "aws_eks_cluster_auth" "auth" {
  name = "${var.env}-${var.cluster_name}"
}
Enter fullscreen mode Exit fullscreen mode

provider.tf

provider "kubernetes" {
  host                   = data.aws_eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
  token                  = data.aws_eks_cluster_auth.auth.token
}

provider "helm" {
  kubernetes {
    host                   = data.aws_eks_cluster.cluster.endpoint
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
    token                  = data.aws_eks_cluster_auth.auth.token
  }
}
Enter fullscreen mode Exit fullscreen mode

Install the chart

resource "helm_release" "csi_secrets_store" {
  name       = "csi-secrets-store"
  repository = "https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts"
  chart      = "secrets-store-csi-driver"
  namespace  = "kube-system"

  set {
    name  = "syncSecret.enabled"
    value = "true"
  }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)