GithubHelp home page GithubHelp logo

terraform-helm-release's Introduction

Helm release Terraform module

Terraform module which creates Helm chart release

These types of resources are supported:

Usage

Create Helm chart release

main.tf

module "helm_release" {
  source = "[email protected]:jangjaelee/terraform-helm-release.git"

  cluster_name     = local.cluster_name
  name             = var.name
  create_namespace = var.create_namespace
  namespace        = var.namespace
  chart_url        = var.chart_url
  chart_name       = var.chart_name
  chart_version    = var.chart_version

  set_values           = var.set_values
  set_sensitive_values = var.set_sensitive_values

  cluster_endpoint = var.cluster_endpoint
  cluster_ca_cert  = var.cluster_ca_cert

  env = var.env
}

locals.tf

locals {
  vpc_name         = "KubeSphere-dev"
  cluster_name     = "KubeSphere-v121-dev"
  cluster_version  = "1.21"
}

providers.tf

provider "aws" {
  region = var.region
  allowed_account_ids = var.account_id
  profile = "eks_service"
}

provider "helm" {
  kubernetes {
    host                   = var.cluster_endpoint
    cluster_ca_certificate = base64decode(var.cluster_ca_cert)
    exec {
      api_version = "client.authentication.k8s.io/v1alpha1"
      args        = ["eks", "get-token", "--cluster-name", local.cluster_name]
      command     = "aws"
    }
  }
}

terraform.tf

terraform {
  required_version = ">= 1.0.0"

  backend "s3" {
    bucket = "kubesphere-terraform-state-backend"
    key = "kubesphere/helm-alb-controller/terraform.tfstate"
    region = "ap-northeast-2"
    dynamodb_table = "kubesphere-terraform-state-locks"
    encrypt = true
    profile = "eks_service"
  }

  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = ">= 3.50.0"
    }

    helm = {
      source = "hashicorp/helm"
      version = ">= 2.2.0"
    }
  }
}

variables.tf

variable "region" {
  description = "AWS Region"
  type        = string
  default     = "ap-northeast-2"
}

variable "account_id" {
  description = "List of Allowed AWS account IDs"
  type        = list(string)
  default     = ["123456789012"]
}

variable "name" {}
variable "create_namespace" {}
variable "namespace" {}
variable "chart_url" {}
variable "chart_name" {}
variable "chart_version" {}
variable "set_values" {}
variable "set_sensitive_values" {}
variable "cluster_endpoint" {}
variable "cluster_ca_cert" {}
variable "env" {}

terraform.tfvars

name                  = "aws-load-balancer-controller"
create_namespace      = false
namespace             = "kube-system"
chart_url             = "https://aws.github.io/eks-charts"
chart_name            = "aws-load-balancer-controller"
chart_version         = "1.3.2"

set_values = [{
    name  = "clusterName"
    value = "KubeSphere-v121-dev"
    type  = "string"
},{
    name  = "serviceAccount.create"
    value = false
    type  = "auto"
},{
    name  = "serviceAccount.name"
    value = "aws-load-balancer-controller"
    type  = "string"
}]

set_sensitive_values = [{
    name  = ""
    value = ""
    type  = "auto"
}]

cluster_endpoint = "https://cluster.kubesphere.kr"
cluster_ca_cert  = "29obGQwTkpqbzB6dEwvZ05WeC9kCm5rSG11YjZ2NUNldXhVTjdaR0U2d1NqeU04MVNvc2hDdlFLWAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="

env = "dev"

terraform-helm-release's People

Contributors

jangjaelee avatar

Stargazers

Michael Einreinhof avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.