diff --git a/README.md b/README.md index af67aa2..a5f8347 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ module "localhost_function" { | bucket\_force\_destroy | When deleting the GCS bucket containing the cloud function, delete all objects in the bucket first. | `bool` | `false` | no | | bucket\_labels | A set of key/value label pairs to assign to the function source archive bucket. | `map(string)` | `{}` | no | | bucket\_name | The name to apply to the bucket. Will default to a string of the function name. | `string` | `""` | no | +| build\_environment\_variables | A set of key/value environment variable pairs available during build time. | `map(string)` | `{}` | no | | create\_bucket | Whether to create a new bucket or use an existing one. If false, `bucket_name` should reference the name of the alternate bucket to use. | `bool` | `true` | no | | description | The description of the function. | `string` | `"Processes events."` | no | | entry\_point | The name of a method in the function source which will be invoked when the function is executed. | `string` | n/a | yes | diff --git a/main.tf b/main.tf index 818805d..b06786e 100644 --- a/main.tf +++ b/main.tf @@ -130,12 +130,13 @@ resource "google_cloudfunctions_function" "main" { } } - labels = var.labels - runtime = var.runtime - environment_variables = var.environment_variables - source_archive_bucket = var.create_bucket ? google_storage_bucket.main[0].name : var.bucket_name - source_archive_object = google_storage_bucket_object.main.name - project = var.project_id - region = var.region - service_account_email = var.service_account_email + labels = var.labels + runtime = var.runtime + environment_variables = var.environment_variables + source_archive_bucket = var.create_bucket ? google_storage_bucket.main[0].name : var.bucket_name + source_archive_object = google_storage_bucket_object.main.name + project = var.project_id + region = var.region + service_account_email = var.service_account_email + build_environment_variables = var.build_environment_variables } diff --git a/variables.tf b/variables.tf index 2542ff2..8ae5135 100644 --- a/variables.tf +++ b/variables.tf @@ -178,3 +178,9 @@ variable "log_object_prefix" { default = null description = "Log object prefix" } + +variable "build_environment_variables" { + type = map(string) + default = {} + description = "A set of key/value environment variable pairs available during build time." +}