Skip to content

Commit 6777831

Browse files
authored
feat: adds optional max_instances input (#59)
1 parent 3bea370 commit 6777831

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ module "localhost_function" {
6363
| event\_trigger\_failure\_policy\_retry | A toggle to determine if the function should be retried on failure. | bool | `"false"` | no |
6464
| ingress\_settings | The ingress settings for the function | string | `"ALLOW_ALL"` | no |
6565
| labels | A set of key/value label pairs to assign to the Cloud Function. | map(string) | `<map>` | no |
66+
| max\_instances | The maximum number of parallel executions of the function. | number | `"0"` | no |
6667
| name | The name to apply to any nameable resources. | string | n/a | yes |
6768
| project\_id | The ID of the project to which resources will be applied. | string | n/a | yes |
6869
| region | The region in which resources will be applied. | string | n/a | yes |

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ data "null_data_source" "wait_for_files" {
4444
data "archive_file" "main" {
4545
type = "zip"
4646
output_path = pathexpand("${var.source_directory}.zip")
47-
source_dir = "${data.null_data_source.wait_for_files.outputs["source_dir"]}"
47+
source_dir = data.null_data_source.wait_for_files.outputs["source_dir"]
4848
}
4949

5050
resource "google_storage_bucket" "main" {
@@ -71,6 +71,7 @@ resource "google_cloudfunctions_function" "main" {
7171
name = var.name
7272
description = var.description
7373
available_memory_mb = var.available_memory_mb
74+
max_instances = var.max_instances
7475
timeout = var.timeout_s
7576
entry_point = var.entry_point
7677
ingress_settings = var.ingress_settings

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ variable "timeout_s" {
8888
description = "The amount of time in seconds allotted for the execution of the function."
8989
}
9090

91+
variable "max_instances" {
92+
type = number
93+
default = 0
94+
description = "The maximum number of parallel executions of the function."
95+
}
96+
9197
variable "bucket_labels" {
9298
type = map(string)
9399
default = {}

0 commit comments

Comments
 (0)