From 0d7aef6523f496bdbbc806092bca6fe9fbfb823b Mon Sep 17 00:00:00 2001 From: None Date: Sun, 7 Jun 2020 23:50:13 +0000 Subject: [PATCH] added remote --- main.tf | 13 +++++++++++++ variables.tf | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index e33f210..ead00e3 100644 --- a/main.tf +++ b/main.tf @@ -30,6 +30,7 @@ data "template_file" "env_vars" { ## template_file.chart_values_template actual values.yaml file from charts data "template_file" "chart_values_template" { + count = "${var.remote_chart == "true" ? 0 : 1 }" template = "${file("charts/${var.deployment_path}/values.yaml")}" vars = "${local.template_all_values}" @@ -37,6 +38,7 @@ data "template_file" "chart_values_template" { ## local_file.deployment_values will create the file output path.module/.cache/values.yaml resource "local_file" "deployment_values" { + count = "${var.remote_chart == "true" ? 0 : 1 }" content = "${trimspace(data.template_file.chart_values_template.rendered)}" filename = "charts/.cache/${var.deployment_name}-values.yaml" } @@ -47,6 +49,7 @@ locals { ## helm_release.helm_deployment is actual helm deployment resource "helm_release" "helm_deployment" { + count = "${var.remote_chart == "true" ? 0 : 1 }" name = "${var.deployment_name}-${var.deployment_environment}" namespace = "${var.deployment_environment}" chart = "./charts/${var.deployment_path}" @@ -58,3 +61,13 @@ resource "helm_release" "helm_deployment" { "${local_file.deployment_values.content}", ] } + +## helm_release.helm_deployment is actual helm deployment +resource "helm_release" "helm_remote_deployment" { + count = "${var.remote_chart == "true" ? 1 : 0 }" + name = "${var.deployment_name}-${var.deployment_environment}" + namespace = "${var.deployment_environment}" + chart = "${var.deployment_path}" + timeout = "${local.timeout}" + recreate_pods = "${local.recreate_pods}" +} diff --git a/variables.tf b/variables.tf index 12566fa..84c85b3 100644 --- a/variables.tf +++ b/variables.tf @@ -41,5 +41,12 @@ variable "recreate_pods" { } variable "release_version" { description = "(Required) Specify the exact chart version to install" + default = " 0.1.0" - } \ No newline at end of file + } + + + variable "remote_chart" { + default = "false" + } +