From 12beb969e5225463cda856283a4001dfa5eff72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levente=20Cs=C5=91ke?= <32789141+tardigrde@users.noreply.github.com> Date: Tue, 23 May 2023 18:00:54 +0200 Subject: [PATCH] feat(TPG >=4.23)!: Add docker_registry variables and use them in google_cloudfunctions_function resource (#164) --- README.md | 3 +++ main.tf | 3 +++ variables.tf | 19 +++++++++++++++++++ versions.tf | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a5f8347..be05e35 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,15 @@ module "localhost_function" { | 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 | +| docker\_registry | Docker Registry to use for storing the function's Docker images. Allowed values are CONTAINER\_REGISTRY (default) and ARTIFACT\_REGISTRY. | `string` | `null` | no | +| docker\_repository | User managed repository created in Artifact Registry optionally with a customer managed encryption key. If specified, deployments will use Artifact Registry. | `string` | `null` | 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 | | environment\_variables | A set of key/value environment variable pairs to assign to the function. | `map(string)` | `{}` | no | | event\_trigger | A source that fires events in response to a condition in another service. | `map(string)` | `{}` | no | | event\_trigger\_failure\_policy\_retry | A toggle to determine if the function should be retried on failure. | `bool` | `false` | no | | files\_to\_exclude\_in\_source\_dir | Specify files to ignore when reading the source\_dir | `list(string)` | `[]` | no | | ingress\_settings | The ingress settings for the function. Allowed values are ALLOW\_ALL, ALLOW\_INTERNAL\_AND\_GCLB and ALLOW\_INTERNAL\_ONLY. Changes to this field will recreate the cloud function. | `string` | `"ALLOW_ALL"` | no | +| kms\_key\_name | Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources. | `string` | `null` | no | | labels | A set of key/value label pairs to assign to the Cloud Function. | `map(string)` | `{}` | no | | log\_bucket | Log bucket | `string` | `null` | no | | log\_object\_prefix | Log object prefix | `string` | `null` | no | diff --git a/main.tf b/main.tf index 9ddc697..e32673e 100644 --- a/main.tf +++ b/main.tf @@ -144,4 +144,7 @@ resource "google_cloudfunctions_function" "main" { region = var.region service_account_email = var.service_account_email build_environment_variables = var.build_environment_variables + docker_registry = var.docker_registry + docker_repository = var.docker_repository + kms_key_name = var.kms_key_name } diff --git a/variables.tf b/variables.tf index 8ae5135..fee2e9b 100644 --- a/variables.tf +++ b/variables.tf @@ -184,3 +184,22 @@ variable "build_environment_variables" { default = {} description = "A set of key/value environment variable pairs available during build time." } + +variable "docker_registry" { + type = string + default = null + description = "Docker Registry to use for storing the function's Docker images. Allowed values are CONTAINER_REGISTRY (default) and ARTIFACT_REGISTRY." +} + +variable "docker_repository" { + type = string + default = null + description = "User managed repository created in Artifact Registry optionally with a customer managed encryption key. If specified, deployments will use Artifact Registry." +} + + +variable "kms_key_name" { + type = string + default = null + description = "Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources." +} diff --git a/versions.tf b/versions.tf index 93e33de..ffb0723 100644 --- a/versions.tf +++ b/versions.tf @@ -20,7 +20,7 @@ terraform { google = { source = "hashicorp/google" - version = ">= 4.11, < 5.0" + version = ">= 4.23, < 5.0" } null = { source = "hashicorp/null"