From 3ad05e2140137bc164fc135c9eca221cdc278dc5 Mon Sep 17 00:00:00 2001 From: Tanawat Panmongkol <40226657+tanawatpan@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:58:08 +0000 Subject: [PATCH] add Helm Chart for Apache SuperSet --- helm_superset.tf | 31 +++++++++++++++++++++++++++++++ main.tf | 6 ++++++ provider.tf | 14 ++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 helm_superset.tf diff --git a/helm_superset.tf b/helm_superset.tf new file mode 100644 index 0000000..f3b1958 --- /dev/null +++ b/helm_superset.tf @@ -0,0 +1,31 @@ +data "http" "values_yaml" { + url = "https://raw.githubusercontent.com/apache/superset/master/helm/superset/values.yaml" +} + +resource "helm_release" "superset" { + name = "superset" + repository = "http://apache.github.io/superset" + chart = "superset" + namespace = "superset" + create_namespace = true + + values = [data.http.values_yaml.response_body] + + set { + name = "bootstrapScript" + value = <<-EOT + #!/bin/bash + pip3 install pyodbc JPype1 + pip3 install sqlalchemy-drill + EOT + } + + set_sensitive { + name = "adminUser.password" + value = var.superset_password + } + + cleanup_on_fail = true + wait_for_jobs = true + timeout = 600 +} diff --git a/main.tf b/main.tf index 66ac2c7..ec7daf3 100644 --- a/main.tf +++ b/main.tf @@ -39,6 +39,12 @@ variable "web_domain" { } } +variable "superset_password" { + type = string + sensitive = true + description = "Superset admin password" +} + locals { cluster_name = "hadoop" diff --git a/provider.tf b/provider.tf index 84617bd..693aed8 100644 --- a/provider.tf +++ b/provider.tf @@ -1,3 +1,7 @@ +provider "tls" {} + +provider "http" {} + provider "google" { project = var.project region = var.region @@ -27,3 +31,13 @@ provider "kubectl" { ) load_config_file = false } + +provider "helm" { + kubernetes { + host = "https://${data.google_container_cluster.hadoop.endpoint}" + token = data.google_client_config.provider.access_token + cluster_ca_certificate = base64decode( + data.google_container_cluster.hadoop.master_auth[0].cluster_ca_certificate, + ) + } +}