From 090cfc97a9c05afa8b852a28ca7b1c98cdf61883 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Wed, 15 Oct 2025 12:05:12 +1100 Subject: [PATCH] fix: exports the cloudrun cpu_idle var and default to `true` See the Terraform docs for why this is required: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_v2_service#cpu_idle-1 --- cloudrun/module/main.tf | 1 + cloudrun/module/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/cloudrun/module/main.tf b/cloudrun/module/main.tf index 12f3f5d..3df789e 100644 --- a/cloudrun/module/main.tf +++ b/cloudrun/module/main.tf @@ -99,6 +99,7 @@ resource "google_cloud_run_v2_service" "service" { containers { image = "${local.service_image_url}@${docker_registry_image.push.sha256_digest}" resources { + cpu_idle = var.cpu_idle limits = merge( { cpu = var.cpus diff --git a/cloudrun/module/variables.tf b/cloudrun/module/variables.tf index a411796..321d75e 100644 --- a/cloudrun/module/variables.tf +++ b/cloudrun/module/variables.tf @@ -22,6 +22,12 @@ variable "memory_mb" { default = 512 } +variable "cpu_idle" { + description = "Determines whether CPU is only allocated during requests" + type = bool + default = true +} + variable "cpus" { description = "The amount of cpus to allocate to the CloudRun service" type = number