From 574c7548d8fa098ab46e9724c8271f37ebec351e Mon Sep 17 00:00:00 2001 From: Jay Schwerberg Date: Thu, 17 Aug 2023 14:36:23 -0700 Subject: [PATCH] feat(cloud-run): add startup cpu boost option --- modules/cloud-run/README.md | 9 +++++---- modules/cloud-run/main.tf | 5 ++++- modules/cloud-run/variables.tf | 6 ++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/cloud-run/README.md b/modules/cloud-run/README.md index 0db9d114..803ddcb6 100644 --- a/modules/cloud-run/README.md +++ b/modules/cloud-run/README.md @@ -352,10 +352,11 @@ module "cloud_run" { | [revision_name](variables.tf#L177) | Revision name. | string | | null | | [service_account](variables.tf#L183) | Service account email. Unused if service account is auto-created. | string | | null | | [service_account_create](variables.tf#L189) | Auto-create service account. | bool | | false | -| [timeout_seconds](variables.tf#L195) | Maximum duration the instance is allowed for responding to a request. | number | | null | -| [traffic](variables.tf#L201) | Traffic steering configuration. If revision name is null the latest revision will be used. | map(object({…})) | | {} | -| [volumes](variables.tf#L212) | Named volumes in containers in name => attributes format. | map(object({…})) | | {} | -| [vpc_connector_create](variables.tf#L226) | Populate this to create a VPC connector. You can then refer to it in the template annotations. | object({…}) | | null | +| [startup_cpu_boost](variables.tf#L195) | Enable startup cpu boost. | bool | | false | +| [timeout_seconds](variables.tf#L201) | Maximum duration the instance is allowed for responding to a request. | number | | null | +| [traffic](variables.tf#L207) | Traffic steering configuration. If revision name is null the latest revision will be used. | map(object({…})) | | {} | +| [volumes](variables.tf#L218) | Named volumes in containers in name => attributes format. | map(object({…})) | | {} | +| [vpc_connector_create](variables.tf#L232) | Populate this to create a VPC connector. You can then refer to it in the template annotations. | object({…}) | | null | ## Outputs diff --git a/modules/cloud-run/main.tf b/modules/cloud-run/main.tf index e5371273..617e67bb 100644 --- a/modules/cloud-run/main.tf +++ b/modules/cloud-run/main.tf @@ -33,7 +33,10 @@ locals { annotations = merge( var.ingress_settings == null ? {} : { "run.googleapis.com/ingress" = var.ingress_settings - } + }, + var.startup_cpu_boost ? { + "run.googleapis.com/startup-cpu-boost" = "true" + } : {} ) _iam_run_invoker_members = concat( lookup(var.iam, "roles/run.invoker", []), diff --git a/modules/cloud-run/variables.tf b/modules/cloud-run/variables.tf index 09d10296..9a4992a7 100644 --- a/modules/cloud-run/variables.tf +++ b/modules/cloud-run/variables.tf @@ -192,6 +192,12 @@ variable "service_account_create" { default = false } +variable "startup_cpu_boost" { + description = "Enable startup cpu boost." + type = bool + default = false +} + variable "timeout_seconds" { description = "Maximum duration the instance is allowed for responding to a request." type = number