Skip to content

Commit

Permalink
Changed the string variables to boolen (#38)
Browse files Browse the repository at this point in the history
Co-authored-by: fsadykov <[email protected]>
  • Loading branch information
fuchicorp-manage and fsadykov authored Aug 19, 2022
1 parent 1b6bd2b commit c1bdabf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Create `module.tf` to call the module from terraform registry, then modify it un
```hcl
module "helm_deploy" {
source = "fuchicorp/chart/helm"
remote_chart = "true" ## Set to true for remote chart
remote_chart = true ## Set to true for remote chart
chart_repo = "https://github.io/helm-charts" ## Provide repository url
enabled = "true" ## Enable to deploy the chart
enabled = true ## Enable to deploy the chart
deployment_name = "example-deployment-name" ## Release name in the namespace
deployment_environment = "dev" ## Kubernetes Namespace
deployment_path = "example-remote-name" ## Name of the remote chart
Expand All @@ -59,8 +59,8 @@ module "helm_deploy_local" {
deployment_name = "my-example-chart" ## Release name in the namespace
deployment_environment = "dev" ## Kubernetes Namespace
deployment_path = "charts/my-example-chart" ## Remote chart location
remote_chart = "false" ## Set to false for local chart
enabled = "true" ## Enable to deploy the chart
remote_chart = false ## Set to false for local chart
enabled = true ## Enable to deploy the chart
template_custom_vars = {
deployment_endpoint = "my-example-chart.domain.com"
deployment_image = "nginx"
Expand All @@ -80,7 +80,7 @@ ingress:
enabled: true
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# kubernetes.io/tls-acme: true
hosts:
- host: ${deployment_endpoint} ## my-example-chart.domain.com
paths: []
Expand All @@ -104,8 +104,8 @@ module "helm_deploy_remote" {
deployment_environment = "dev"
deployment_path = "grafana/grafana"
chart_repo = "https://grafana.github.io/helm-charts"
enabled = "true"
remote_chart = "true"
enabled = true
remote_chart = true
release_version = "6.22.0"
remote_override_values = <<EOF
Expand All @@ -117,7 +117,7 @@ ingress:
enabled: true
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# kubernetes.io/tls-acme: true
hosts:
- host: ${var.grafana_endpoint} ## grafana.domain.com
paths:
Expand Down Expand Up @@ -160,8 +160,8 @@ module "helm_deploy_local" {
deployment_name = "my-example-chart" ## Release name in the namespace
deployment_environment = "dev" ## Kubernetes Namespace
deployment_path = "charts/my-example-chart" ## Remote chart location
remote_chart = "false" ## Set to false for local chart
enabled = "true" ## Enable to deploy the chart
remote_chart = false ## Set to false for local chart
enabled = true ## Enable to deploy the chart
template_custom_vars = {
deployment_endpoint = "my-example-chart.domain.com"
deployment_image = "nginx"
Expand All @@ -182,7 +182,7 @@ ingress:
enabled: true
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# kubernetes.io/tls-acme: true
hosts:
- host: ${deployment_endpoint} ## my-example-chart.domain.com
paths: []
Expand All @@ -209,8 +209,8 @@ For more info, please see the [variables file](https://github.com/fuchicorp/terr
| `release_version` | Specify the exact chart version to install. | `(Optional)` | `string` |
| `remote_override_values` | Specify the name of the file to override default `values.yaml file` | `(Optional)` | `string` |
| `chart_repo` | Url of the repository for the helm charts | `(Optional)` | `string` |
| `remote_chart` | Specify whether to deploy remote_chart to `"true"` or `"false"` default value is `"false"` | `(Optional)` | `bool` |
| `enabled` | Specify if you want to deploy the enabled to `"true"` or `"false"` default value is `"true"`| `(Optional)` | `bool` |
| `remote_chart` | Specify whether to deploy remote_chart to `true` or `false` default value is `false` | `(Optional)` | `bool` |
| `enabled` | Specify if you want to deploy the enabled to `true` or `false` default value is `true`| `(Optional)` | `bool` |
| `template_custom_vars` | Template custom veriables you can modify variables by parsting the `template_custom_vars` | `(Optional)` | `map` |
| `timeout` | If you would like to increase the timeout | `(Optional)` | `number` |
| `recreate_pods` | On update performs pods restart for the resource if applicable. | `(Optional)` | `bool` |
Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ locals {

## The remote chart deployment
resource "helm_release" "helm_remote_deployment" {
count = var.enabled == "true" && var.remote_chart == "true" ? 1 : 0
count = var.enabled == true && var.remote_chart == true ? 1 : 0
name = var.deployment_name
namespace = var.deployment_environment
chart = var.deployment_path
Expand All @@ -33,7 +33,7 @@ resource "helm_release" "helm_remote_deployment" {

## The local chart deployment
resource "helm_release" "helm_local_deployment" {
count = var.enabled == "true" && var.remote_chart == "false" ? 1 : 0
count = var.enabled == true && var.remote_chart == false ? 1 : 0
name = var.deployment_name
namespace = var.deployment_environment
chart = var.deployment_path
Expand All @@ -48,7 +48,7 @@ resource "helm_release" "helm_local_deployment" {

## The local chart values.yaml
data "template_file" "local_chart_values_template" {
count = var.enabled == "true" && var.remote_chart == "false" ? 1 : 0
count = var.enabled == true && var.remote_chart == false ? 1 : 0
template = file("${var.deployment_path}/${var.values}")
vars = local.template_all_values
}
9 changes: 6 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ variable "release_version" {
}

variable "remote_chart" {
default = "false"
type = bool
default = false
description = "-(Optional) For the remote charts set to <true>"
}

variable "enabled" {
default = "true"
type = bool
default = true
description = "-(Optional) deployment can be disabled or enabled by using this bool!"
}

Expand All @@ -45,7 +47,8 @@ variable "timeout" {
}

variable "recreate_pods" {
default = false
type = bool
default = false
}

variable "values" {
Expand Down

0 comments on commit c1bdabf

Please sign in to comment.