Skip to content

Commit

Permalink
Merge pull request #8 from fuchicorp/feature/remote
Browse files Browse the repository at this point in the history
added remote
  • Loading branch information
fsadykov authored Jun 8, 2020
2 parents 10f7f97 + 0d7aef6 commit 6b8c260
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ 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}"
}

## 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"
}
Expand All @@ -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}"
Expand All @@ -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}"
}
9 changes: 8 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,12 @@ variable "recreate_pods" {
}
variable "release_version" {
description = "(Required) Specify the exact chart version to install"
default = " 0.1.0"

}
}


variable "remote_chart" {
default = "false"
}

0 comments on commit 6b8c260

Please sign in to comment.