-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapplication.tf
More file actions
103 lines (95 loc) · 2.81 KB
/
Copy pathapplication.tf
File metadata and controls
103 lines (95 loc) · 2.81 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
locals {
app_values = <<-EOF
ingress:
enabled: true
className: gwin-default
annotations: ${jsonencode(local.gwin_annotations)}
hosts:
- host: ${var.target_host}
paths:
- path: /api/
pathType: Prefix
serviceName: "todo-backend"
servicePort: "8080"
- path: /
pathType: Prefix
serviceName: "todo-frontend"
servicePort: "80"
tls:
- secretName: yc-certmgr-cert-id-${local.cert_id}
hosts:
- ${var.target_host}
backend:
replicaCount: ${length(local.k8s_node_subnet_ids)}
image:
repository: ${var.app_backend_image}
tag: "${var.app_backend_tag}"
service:
externalTrafficPolicy: Local
type: NodePort
port: 8080
db:
host: "c-${yandex_mdb_postgresql_cluster.this.id}.rw.mdb.yandexcloud.net"
port: "6432"
database: "${yandex_mdb_postgresql_database.db1.name}"
user: "${yandex_mdb_postgresql_user.user1.name}"
password: "${yandex_mdb_postgresql_user.user1.password}"
tz: "Europe/Moscow"
roDb:
host: "c-${yandex_mdb_postgresql_cluster.this.id}.rw.mdb.yandexcloud.net"
frontend:
replicaCount: ${length(local.k8s_node_subnet_ids)}
image:
repository: ${var.app_frontend_image}
tag: "${var.app_frontend_tag == null ? var.app_backend_tag : var.app_frontend_tag}"
service:
externalTrafficPolicy: Local
type: NodePort
port: 80
EOF
}
resource "helm_release" "application" {
count = var.app_enabled == true ? 1 : 0
name = "todo"
namespace = "todo"
repository = "oci://cr.yandex/docs-registry/helm/todo"
chart = "todo"
version = "0.1.0"
create_namespace = true
values = [
local.app_values
]
depends_on = [
resource.null_resource.infra
]
timeout = 180
wait = false
}
###################################################################
############################ Variables ############################
###################################################################
variable "app_enabled" {
type = bool
description = "Enable application deploy"
default = true
}
variable "app_backend_image" {
type = string
description = "backend registry path"
default = "cr.yandex/docs-registry/app/todo-backend"
}
variable "app_backend_tag" {
type = string
description = "backend tag"
default = "v0.0.1"
}
variable "app_frontend_image" {
type = string
description = "backend registry path"
default = "cr.yandex/docs-registry/app/todo-frontend"
}
variable "app_frontend_tag" {
type = string
description = "frontend tag"
default = "v0.0.1"
}