-
Notifications
You must be signed in to change notification settings - Fork 26
/
main.tf
47 lines (40 loc) · 1.46 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
locals {
required_values = {
# Deployment endpoint for ingress
deployment_endpoint = lower(var.deployment_endpoint)
## The release name will be
deployment_name = lower(var.deployment_name)
}
# When all requred values all deffined then also will incloude users values
template_all_values = merge(local.required_values, var.template_custom_vars)
timeout = var.timeout
recreate_pods = var.recreate_pods
trigger = var.trigger == "UUID" ? uuid() : var.trigger
}
## The remote chart deployment
resource "helm_release" "helm_remote_deployment" {
count = var.enabled == true && var.remote_chart == true ? 1 : 0
name = var.deployment_name
namespace = var.deployment_environment
chart = var.deployment_path
timeout = local.timeout
recreate_pods = local.recreate_pods
version = var.release_version
repository = var.chart_repo
values = [
var.remote_override_values
]
}
## The local chart deployment
resource "helm_release" "helm_local_deployment" {
count = var.enabled == true && var.remote_chart == false ? 1 : 0
name = var.deployment_name
namespace = var.deployment_environment
chart = var.deployment_path
timeout = local.timeout
recreate_pods = local.recreate_pods
version = var.release_version
values = [
trimspace(templatefile("${var.deployment_path}/${var.values}", local.template_all_values))
]
}