From ab5752ffceed88bc1ec438f887b9cdb5a4d75724 Mon Sep 17 00:00:00 2001 From: Shion Ichikawa Date: Mon, 15 Apr 2024 19:43:03 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20cloud=20run=E3=81=AEv2=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E7=A7=BB=E8=A1=8C=20/=20memory=20limit=E3=82=92?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- envs/dev/cloudrun.tf | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/envs/dev/cloudrun.tf b/envs/dev/cloudrun.tf index 070c104..753f273 100755 --- a/envs/dev/cloudrun.tf +++ b/envs/dev/cloudrun.tf @@ -1,32 +1,33 @@ -resource "google_cloud_run_service" "cloudrun-dev-main-backend" { +resource "google_cloud_run_v2_service" "cloudrun-dev-main-backend" { name = "dev-main-backend" location = var.region template { - spec { - containers { - name = "nginx" - image = "asia-northeast1-docker.pkg.dev/${var.project_id}/dev-main/nginx:latest" - ports { - container_port = 80 + containers { + name = "nginx" + image = "asia-northeast1-docker.pkg.dev/${var.project_id}/dev-main/nginx:latest" + ports { + container_port = 80 + } + resources { + limits = { + "memory" = "1024Mi" } } + } - - containers { - name = "backend" - image = "asia-northeast1-docker.pkg.dev/${var.project_id}/dev-main/backend:latest" - env { - name = "PORT" - value = "8080" - } + containers { + name = "backend" + image = "asia-northeast1-docker.pkg.dev/${var.project_id}/dev-main/backend:latest" + env { + name = "PORT" + value = "8080" } } } traffic { - percent = 100 - latest_revision = true + percent = 100 } } @@ -40,9 +41,9 @@ data "google_iam_policy" "noauth" { } resource "google_cloud_run_service_iam_policy" "noauth" { - location = google_cloud_run_service.cloudrun-dev-main-backend.location - project = google_cloud_run_service.cloudrun-dev-main-backend.project - service = google_cloud_run_service.cloudrun-dev-main-backend.name + location = google_cloud_run_v2_service.cloudrun-dev-main-backend.location + project = google_cloud_run_v2_service.cloudrun-dev-main-backend.project + service = google_cloud_run_v2_service.cloudrun-dev-main-backend.name policy_data = data.google_iam_policy.noauth.policy_data }