feat(cloud-function-v2): add support for max_instance_request_concurrency (#3822)
Fixes #3718
This commit is contained in:
committed by
GitHub
parent
ee8ae023d0
commit
0e9fd6bbc1
@@ -437,9 +437,9 @@ module "cf_http" {
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [bucket_name](variables.tf#L27) | Name of the bucket that will be used for the function code. It will be created with prefix prepended if bucket_config is not null. | <code>string</code> | ✓ | |
|
||||
| [bundle_config](variables.tf#L51) | Cloud function source. Path can point to a GCS object URI, or a local path. A local path to a zip archive will generate a GCS object using its basename, a folder will be zipped and the GCS object name inferred when not specified. | <code title="object({ path = string folder_options = optional(object({ archive_path = optional(string) excludes = optional(list(string)) }), {}) })">object({…})</code> | ✓ | |
|
||||
| [name](variables.tf#L185) | Name used for cloud function and associated resources. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L200) | Project id used for all resources. | <code>string</code> | ✓ | |
|
||||
| [region](variables.tf#L205) | Region used for all resources. | <code>string</code> | ✓ | |
|
||||
| [name](variables.tf#L186) | Name used for cloud function and associated resources. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L201) | Project id used for all resources. | <code>string</code> | ✓ | |
|
||||
| [region](variables.tf#L206) | Region used for all resources. | <code>string</code> | ✓ | |
|
||||
| [bucket_config](variables.tf#L17) | Enable and configure auto-created bucket. Set fields to null to use defaults. | <code title="object({ force_destroy = optional(bool) lifecycle_delete_age_days = optional(number) location = optional(string) })">object({…})</code> | | <code>null</code> |
|
||||
| [build_environment_variables](variables.tf#L33) | A set of key/value environment variable pairs available during build time. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [build_service_account](variables.tf#L39) | Build service account email. | <code>string</code> | | <code>null</code> |
|
||||
@@ -449,16 +449,16 @@ module "cf_http" {
|
||||
| [direct_vpc_egress](variables.tf#L108) | Direct VPC egress configuration. | <code title="object({ mode = string network = string subnetwork = string tags = optional(list(string)) })">object({…})</code> | | <code>null</code> |
|
||||
| [docker_repository_id](variables.tf#L126) | User managed repository created in Artifact Registry. | <code>string</code> | | <code>null</code> |
|
||||
| [environment_variables](variables.tf#L132) | Cloud function environment variables. | <code>map(string)</code> | | <code title="{ LOG_EXECUTION_ID = "true" }">{…}</code> |
|
||||
| [function_config](variables.tf#L140) | Cloud function configuration. Defaults to using main as entrypoint, 1 instance with 256MiB of memory, and 180 second timeout. | <code title="object({ binary_authorization_policy = optional(string) entry_point = optional(string, "main") instance_count = optional(number, 1) memory_mb = optional(number, 256) # Memory in MB cpu = optional(string, "0.166") runtime = optional(string, "python310") timeout_seconds = optional(number, 180) })">object({…})</code> | | <code title="{ entry_point = "main" instance_count = 1 memory_mb = 256 cpu = "0.166" runtime = "python310" timeout_seconds = 180 }">{…}</code> |
|
||||
| [iam](variables.tf#L161) | IAM bindings for topic in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [ingress_settings](variables.tf#L167) | Control traffic that reaches the cloud function. Allowed values are ALLOW_ALL, ALLOW_INTERNAL_AND_GCLB and ALLOW_INTERNAL_ONLY . | <code>string</code> | | <code>null</code> |
|
||||
| [kms_key](variables.tf#L173) | Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources in key id format. If specified, you must also provide an artifact registry repository using the docker_repository_id field that was created with the same KMS crypto key. | <code>string</code> | | <code>null</code> |
|
||||
| [labels](variables.tf#L179) | Resource labels. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [prefix](variables.tf#L190) | Optional prefix used for resource names. | <code>string</code> | | <code>null</code> |
|
||||
| [secrets](variables.tf#L210) | Secret Manager secrets. Key is the variable name or mountpoint, volume versions are in version:path format. | <code title="map(object({ is_volume = bool project_id = string secret = string versions = list(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [function_config](variables.tf#L140) | Cloud function configuration. Defaults to using main as entrypoint, 1 instance with 256MiB of memory, and 180 second timeout. | <code title="object({ binary_authorization_policy = optional(string) entry_point = optional(string, "main") instance_count = optional(number, 1) max_instance_request_concurrency = optional(number) memory_mb = optional(number, 256) # Memory in MB cpu = optional(string, "0.166") runtime = optional(string, "python310") timeout_seconds = optional(number, 180) })">object({…})</code> | | <code title="{ entry_point = "main" instance_count = 1 memory_mb = 256 cpu = "0.166" runtime = "python310" timeout_seconds = 180 }">{…}</code> |
|
||||
| [iam](variables.tf#L162) | IAM bindings for topic in {ROLE => [MEMBERS]} format. | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [ingress_settings](variables.tf#L168) | Control traffic that reaches the cloud function. Allowed values are ALLOW_ALL, ALLOW_INTERNAL_AND_GCLB and ALLOW_INTERNAL_ONLY . | <code>string</code> | | <code>null</code> |
|
||||
| [kms_key](variables.tf#L174) | Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources in key id format. If specified, you must also provide an artifact registry repository using the docker_repository_id field that was created with the same KMS crypto key. | <code>string</code> | | <code>null</code> |
|
||||
| [labels](variables.tf#L180) | Resource labels. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [prefix](variables.tf#L191) | Optional prefix used for resource names. | <code>string</code> | | <code>null</code> |
|
||||
| [secrets](variables.tf#L211) | Secret Manager secrets. Key is the variable name or mountpoint, volume versions are in version:path format. | <code title="map(object({ is_volume = bool project_id = string secret = string versions = list(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [service_account_config](variables-serviceaccount.tf#L17) | Service account configurations. | <code title="object({ create = optional(bool, true) display_name = optional(string) email = optional(string) name = optional(string) roles = optional(list(string), [ "roles/logging.logWriter", "roles/monitoring.metricWriter" ]) })">object({…})</code> | | <code>{}</code> |
|
||||
| [trigger_config](variables.tf#L222) | Function trigger configuration. Leave null for HTTP trigger. | <code title="object({ event_type = string pubsub_topic = optional(string) region = optional(string) event_filters = optional(list(object({ attribute = string value = string operator = optional(string) })), []) service_account_email = optional(string) service_account_create = optional(bool, false) retry_policy = optional(string, "RETRY_POLICY_DO_NOT_RETRY") # default to avoid permadiff })">object({…})</code> | | <code>null</code> |
|
||||
| [vpc_connector](variables.tf#L240) | VPC connector configuration. Set create to 'true' if a new connector needs to be created. | <code title="object({ name = optional(string) egress_settings = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [trigger_config](variables.tf#L223) | Function trigger configuration. Leave null for HTTP trigger. | <code title="object({ event_type = string pubsub_topic = optional(string) region = optional(string) event_filters = optional(list(object({ attribute = string value = string operator = optional(string) })), []) service_account_email = optional(string) service_account_create = optional(bool, false) retry_policy = optional(string, "RETRY_POLICY_DO_NOT_RETRY") # default to avoid permadiff })">object({…})</code> | | <code>null</code> |
|
||||
| [vpc_connector](variables.tf#L241) | VPC connector configuration. Set create to 'true' if a new connector needs to be created. | <code title="object({ name = optional(string) egress_settings = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [vpc_connector_create](variables-vpcconnector.tf#L17) | VPC connector network configuration. Must be provided if new VPC connector is being created. | <code title="object({ ip_cidr_range = optional(string) machine_type = optional(string) name = optional(string) network = optional(string) instances = optional(object({ max = optional(number) min = optional(number) }), {} ) throughput = optional(object({ max = optional(number) min = optional(number) }), {} ) subnet = optional(object({ name = optional(string) project_id = optional(string) }), {}) })">object({…})</code> | | <code>null</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
@@ -93,19 +93,20 @@ resource "google_cloudfunctions2_function" "function" {
|
||||
}
|
||||
}
|
||||
service_config {
|
||||
all_traffic_on_latest_revision = true
|
||||
available_cpu = var.function_config.cpu
|
||||
available_memory = "${var.function_config.memory_mb}M"
|
||||
binary_authorization_policy = var.function_config.binary_authorization_policy
|
||||
environment_variables = var.environment_variables
|
||||
ingress_settings = var.ingress_settings
|
||||
max_instance_count = var.function_config.instance_count
|
||||
min_instance_count = 0
|
||||
service_account_email = local.service_account_email
|
||||
timeout_seconds = var.function_config.timeout_seconds
|
||||
vpc_connector = local.vpc_connector
|
||||
vpc_connector_egress_settings = var.vpc_connector.egress_settings
|
||||
direct_vpc_egress = try(var.direct_vpc_egress.mode, null)
|
||||
all_traffic_on_latest_revision = true
|
||||
available_cpu = var.function_config.cpu
|
||||
available_memory = "${var.function_config.memory_mb}M"
|
||||
binary_authorization_policy = var.function_config.binary_authorization_policy
|
||||
environment_variables = var.environment_variables
|
||||
ingress_settings = var.ingress_settings
|
||||
max_instance_count = var.function_config.instance_count
|
||||
max_instance_request_concurrency = var.function_config.max_instance_request_concurrency
|
||||
min_instance_count = 0
|
||||
service_account_email = local.service_account_email
|
||||
timeout_seconds = var.function_config.timeout_seconds
|
||||
vpc_connector = local.vpc_connector
|
||||
vpc_connector_egress_settings = var.vpc_connector.egress_settings
|
||||
direct_vpc_egress = try(var.direct_vpc_egress.mode, null)
|
||||
|
||||
dynamic "direct_vpc_network_interface" {
|
||||
for_each = var.direct_vpc_egress == null ? [] : [""]
|
||||
|
||||
@@ -140,13 +140,14 @@ variable "environment_variables" {
|
||||
variable "function_config" {
|
||||
description = "Cloud function configuration. Defaults to using main as entrypoint, 1 instance with 256MiB of memory, and 180 second timeout."
|
||||
type = object({
|
||||
binary_authorization_policy = optional(string)
|
||||
entry_point = optional(string, "main")
|
||||
instance_count = optional(number, 1)
|
||||
memory_mb = optional(number, 256) # Memory in MB
|
||||
cpu = optional(string, "0.166")
|
||||
runtime = optional(string, "python310")
|
||||
timeout_seconds = optional(number, 180)
|
||||
binary_authorization_policy = optional(string)
|
||||
entry_point = optional(string, "main")
|
||||
instance_count = optional(number, 1)
|
||||
max_instance_request_concurrency = optional(number)
|
||||
memory_mb = optional(number, 256) # Memory in MB
|
||||
cpu = optional(string, "0.166")
|
||||
runtime = optional(string, "python310")
|
||||
timeout_seconds = optional(number, 180)
|
||||
})
|
||||
default = {
|
||||
entry_point = "main"
|
||||
|
||||
Reference in New Issue
Block a user