Skip to content

Commit e904375

Browse files
committed
Remove Cloud Run service deployment from Terraform
1 parent 9c700ce commit e904375

File tree

2 files changed

+148
-132
lines changed

2 files changed

+148
-132
lines changed

go/cloudbuild.yaml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ steps:
4040
- '--set-secrets=DATABASE_URL=DATABASE_URL:latest'
4141
- '--cpu-boost'
4242
- '--allow-unauthenticated'
43-
# - id: 'Deploy container image to Cloud Run for test'
44-
# name: 'gcr.io/cloud-builders/gcloud'
45-
# args:
46-
# - 'run'
47-
# - 'deploy'
48-
# - 'company-ranking-test-server'
49-
# - '--image=gcr.io/$PROJECT_ID/company-ranking-server:latest'
50-
# - '--region=asia-northeast1'
51-
# - '--project=company-ranking-prod'
52-
# - '--port=8080'
53-
# - '--cpu=1000m'
54-
# - '--memory=512Mi'
55-
# - '--min-instances=0'
56-
# - '--max-instances=1'
57-
# - '--concurrency=80'
58-
# - '--timeout=300s'
59-
# - '--service-account=1026927710795-compute@developer.gserviceaccount.com'
60-
# - '--set-env-vars=FRONT_URL=company-ranking-test.vercel.app'
61-
# - '--set-secrets=DATABASE_URL=DATABASE_URL:latest'
62-
# - '--cpu-boost'
63-
# - '--allow-unauthenticated'
43+
- id: 'Deploy container image to Cloud Run for test'
44+
name: 'gcr.io/cloud-builders/gcloud'
45+
args:
46+
- 'run'
47+
- 'deploy'
48+
- 'company-ranking-test-server'
49+
- '--image=gcr.io/$PROJECT_ID/company-ranking-server:latest'
50+
- '--region=asia-northeast1'
51+
- '--project=company-ranking-prod'
52+
- '--port=8080'
53+
- '--cpu=1000m'
54+
- '--memory=512Mi'
55+
- '--min-instances=0'
56+
- '--max-instances=1'
57+
- '--concurrency=80'
58+
- '--timeout=300s'
59+
- '--service-account=1026927710795-compute@developer.gserviceaccount.com'
60+
- '--set-env-vars=FRONT_URL=company-ranking-test.vercel.app'
61+
- '--set-secrets=DATABASE_URL=DATABASE_TEST_URL:latest'
62+
- '--cpu-boost'
63+
- '--allow-unauthenticated'
6464
images:
6565
- 'gcr.io/$PROJECT_ID/company-ranking-server:$COMMIT_SHA'
Lines changed: 127 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,134 @@
1-
resource "google_cloud_run_v2_service" "company_ranking_server" {
2-
ingress = "INGRESS_TRAFFIC_ALL"
3-
location = "asia-northeast1"
4-
name = "company-ranking-server"
5-
project = "company-ranking-prod"
6-
template {
7-
max_instance_request_concurrency = 80
8-
service_account = "[email protected]"
9-
timeout = "300s"
10-
containers {
11-
image = "gcr.io/company-ranking-prod/company-ranking-server:latest"
12-
name = "company-ranking-server-1"
13-
env {
14-
name = "FRONT_URL"
15-
value = "company-ranking.net"
16-
}
17-
env {
18-
name = "DATABASE_URL"
19-
value_source {
20-
secret_key_ref {
21-
secret = "DATABASE_URL"
22-
version = "latest"
23-
}
24-
}
25-
}
26-
ports {
27-
container_port = 8080
28-
name = "http1"
29-
}
30-
resources {
31-
cpu_idle = true
32-
limits = {
33-
cpu = "1000m"
34-
memory = "512Mi"
35-
}
36-
startup_cpu_boost = true
37-
}
38-
startup_probe {
39-
failure_threshold = 1
40-
period_seconds = 240
41-
timeout_seconds = 240
42-
tcp_socket {
43-
port = 8080
44-
}
45-
}
46-
}
47-
scaling {
48-
max_instance_count = 1
49-
min_instance_count = 0
50-
}
51-
}
52-
1+
# Cloud Run service is deployed by gcloud command using cloudbuild
2+
# So, we don't need to deploy Cloud Run service by Terraform to avoid conflict
3+
removed {
4+
from = google_cloud_run_v2_service.company_ranking_server
535
lifecycle {
54-
ignore_changes = [
55-
client,
56-
client_version,
57-
]
6+
destroy = false
587
}
598
}
609

61-
resource "google_cloud_run_v2_service" "company_ranking_test_server" {
62-
ingress = "INGRESS_TRAFFIC_ALL"
63-
location = "asia-northeast1"
64-
name = "company-ranking-test-server"
65-
project = "company-ranking-prod"
66-
template {
67-
max_instance_request_concurrency = 80
68-
service_account = "[email protected]"
69-
timeout = "300s"
70-
containers {
71-
image = "gcr.io/company-ranking-prod/company-ranking-server:latest"
72-
name = "company-ranking-server-1"
73-
env {
74-
name = "FRONT_URL"
75-
value = "company-ranking.net"
76-
}
77-
env {
78-
name = "DATABASE_URL"
79-
value_source {
80-
secret_key_ref {
81-
secret = "DATABASE_TEST_URL"
82-
version = "latest"
83-
}
84-
}
85-
}
86-
ports {
87-
container_port = 8080
88-
name = "http1"
89-
}
90-
resources {
91-
cpu_idle = true
92-
limits = {
93-
cpu = "1000m"
94-
memory = "512Mi"
95-
}
96-
}
97-
startup_probe {
98-
failure_threshold = 1
99-
period_seconds = 240
100-
timeout_seconds = 240
101-
tcp_socket {
102-
port = 8080
103-
}
104-
}
105-
}
106-
scaling {
107-
max_instance_count = 1
108-
min_instance_count = 0
109-
}
110-
}
111-
10+
removed {
11+
from = google_cloud_run_v2_service.company_ranking_test_server
11212
lifecycle {
113-
ignore_changes = [
114-
client,
115-
client_version,
116-
]
13+
destroy = false
11714
}
11815
}
16+
17+
# resource "google_cloud_run_v2_service" "company_ranking_server" {
18+
# ingress = "INGRESS_TRAFFIC_ALL"
19+
# location = "asia-northeast1"
20+
# name = "company-ranking-server"
21+
# project = "company-ranking-prod"
22+
# template {
23+
# max_instance_request_concurrency = 80
24+
# service_account = "[email protected]"
25+
# timeout = "300s"
26+
# containers {
27+
# image = "gcr.io/company-ranking-prod/company-ranking-server:latest"
28+
# name = "company-ranking-server-1"
29+
# env {
30+
# name = "FRONT_URL"
31+
# value = "company-ranking.net"
32+
# }
33+
# env {
34+
# name = "DATABASE_URL"
35+
# value_source {
36+
# secret_key_ref {
37+
# secret = "DATABASE_URL"
38+
# version = "latest"
39+
# }
40+
# }
41+
# }
42+
# ports {
43+
# container_port = 8080
44+
# name = "http1"
45+
# }
46+
# resources {
47+
# cpu_idle = true
48+
# limits = {
49+
# cpu = "1000m"
50+
# memory = "512Mi"
51+
# }
52+
# startup_cpu_boost = true
53+
# }
54+
# startup_probe {
55+
# failure_threshold = 1
56+
# period_seconds = 240
57+
# timeout_seconds = 240
58+
# tcp_socket {
59+
# port = 8080
60+
# }
61+
# }
62+
# }
63+
# scaling {
64+
# max_instance_count = 1
65+
# min_instance_count = 0
66+
# }
67+
# }
68+
69+
# lifecycle {
70+
# ignore_changes = [
71+
# client,
72+
# client_version,
73+
# ]
74+
# }
75+
# }
76+
77+
# resource "google_cloud_run_v2_service" "company_ranking_test_server" {
78+
# ingress = "INGRESS_TRAFFIC_ALL"
79+
# location = "asia-northeast1"
80+
# name = "company-ranking-test-server"
81+
# project = "company-ranking-prod"
82+
# template {
83+
# max_instance_request_concurrency = 80
84+
# service_account = "[email protected]"
85+
# timeout = "300s"
86+
# containers {
87+
# image = "gcr.io/company-ranking-prod/company-ranking-server:latest"
88+
# name = "company-ranking-server-1"
89+
# env {
90+
# name = "FRONT_URL"
91+
# value = "company-ranking.net"
92+
# }
93+
# env {
94+
# name = "DATABASE_URL"
95+
# value_source {
96+
# secret_key_ref {
97+
# secret = "DATABASE_TEST_URL"
98+
# version = "latest"
99+
# }
100+
# }
101+
# }
102+
# ports {
103+
# container_port = 8080
104+
# name = "http1"
105+
# }
106+
# resources {
107+
# cpu_idle = true
108+
# limits = {
109+
# cpu = "1000m"
110+
# memory = "512Mi"
111+
# }
112+
# }
113+
# startup_probe {
114+
# failure_threshold = 1
115+
# period_seconds = 240
116+
# timeout_seconds = 240
117+
# tcp_socket {
118+
# port = 8080
119+
# }
120+
# }
121+
# }
122+
# scaling {
123+
# max_instance_count = 1
124+
# min_instance_count = 0
125+
# }
126+
# }
127+
128+
# lifecycle {
129+
# ignore_changes = [
130+
# client,
131+
# client_version,
132+
# ]
133+
# }
134+
# }

0 commit comments

Comments
 (0)