-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
59 lines (56 loc) · 1.17 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
56
57
58
59
resource "google_project_iam_member" "artifact_role" {
role = "roles/artifactregistry.reader"
member = "serviceAccount:${var.gke_service_account_name}"
project = var.gcp_project_id
}
resource "kubernetes_namespace" "nodejs" {
metadata {
name = "nodejs-namespace"
}
}
resource "kubernetes_deployment" "api-skaffold" {
metadata {
name = "test"
namespace = "nodejs-namespace"
}
spec {
replicas = 1
selector {
match_labels = {
app = "test"
}
}
template {
metadata {
labels = {
app = "test"
}
}
spec {
container {
image = "europe-west3-docker.pkg.dev/deploying-with-terraform/express/api-skaffold:v1"
name = "test"
port {
container_port = 3000
}
}
}
}
}
}
resource "kubernetes_service" "api-skaffold_service" {
metadata {
name = "test"
namespace = "nodejs-namespace"
}
spec {
selector = {
app = kubernetes_deployment.api-skaffold.spec.0.template.0.metadata.0.labels.app
}
type = "LoadBalancer"
port {
port = 3000
target_port = 3000
}
}
}