-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
55 lines (47 loc) · 1.1 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
48
49
50
51
52
53
54
55
variable "namespace" {
type = string
}
variable "service_name" {
default = "dbsync-v3-pgbouncer"
}
resource "kubernetes_service_v1" "dbsync_v3_service" {
metadata {
namespace = var.namespace
name = var.service_name
annotations = {
"beta.kubernetes.io/aws-load-balancer-nlb-target-type" = "instance"
"service.beta.kubernetes.io/aws-load-balancer-scheme" = "internet-facing"
"service.beta.kubernetes.io/aws-load-balancer-type" = "external"
}
}
spec {
type = "LoadBalancer"
load_balancer_class = "service.k8s.aws/nlb"
port {
protocol = "TCP"
port = 5432
target_port = 6432
}
selector = {
"role" = "pgbouncer"
}
}
}
resource "kubernetes_service_v1" "postgres_service" {
metadata {
name = "dbsync-blockfrost-postgres"
namespace = var.namespace
}
spec {
type = "ClusterIP"
selector = {
role = "postgres"
is_blockfrost_backend = "true"
}
port {
port = 5432
target_port = 5432
name = "postgres"
}
}
}