From 5c9ddcdc707543d2ad144d00dbbb1f0a33bf25d6 Mon Sep 17 00:00:00 2001 From: Alex Rohvarger Date: Tue, 14 Nov 2023 17:45:53 -0500 Subject: [PATCH] feat(TPG >=4.23)!: Add function_docker_registry variables and use them in terraform-google-event-function module (#150) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Levente Csoke Co-authored-by: Levente Csőke <32789141+tardigrde@users.noreply.github.com> --- README.md | 3 +++ main.tf | 3 +++ variables.tf | 18 ++++++++++++++++++ versions.tf | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9418672..a6d6613 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,12 @@ Then perform the following commands on the root folder: | bucket\_name | The name to apply to the bucket. Will default to a string of -scheduled-function-XXXX> with XXXX being random characters. | `string` | `""` | no | | function\_available\_memory\_mb | The amount of memory in megabytes allotted for the function to use. | `number` | `256` | no | | function\_description | The description of the function. | `string` | `"Processes log export events provided through a Pub/Sub topic subscription."` | no | +| function\_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 | +| function\_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 | | function\_entry\_point | The name of a method in the function source which will be invoked when the function is executed. | `string` | n/a | yes | | function\_environment\_variables | A set of key/value environment variable pairs to assign to the function. | `map(string)` | `{}` | no | | function\_event\_trigger\_failure\_policy\_retry | A toggle to determine if the function should be retried on failure. | `bool` | `false` | no | +| function\_kms\_key\_name | Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources. | `string` | `null` | no | | function\_labels | A set of key/value label pairs to assign to the function. | `map(string)` | `{}` | no | | function\_max\_instances | The maximum number of parallel executions of the function. | `number` | `null` | no | | function\_name | The name to apply to the function | `string` | n/a | yes | diff --git a/main.tf b/main.tf index 9b2a454..ef876c8 100644 --- a/main.tf +++ b/main.tf @@ -88,6 +88,9 @@ module "main" { timeout_s = var.function_timeout_s max_instances = var.function_max_instances ingress_settings = var.ingress_settings + docker_registry = var.function_docker_registry + docker_repository = var.function_docker_repository + kms_key_name = var.function_kms_key_name vpc_connector = var.vpc_connector vpc_connector_egress_settings = var.vpc_connector_egress_settings } diff --git a/variables.tf b/variables.tf index d365871..97841da 100644 --- a/variables.tf +++ b/variables.tf @@ -128,6 +128,24 @@ variable "ingress_settings" { description = "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." } +variable "function_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 "function_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 "function_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." +} + variable "vpc_connector" { type = string default = null diff --git a/versions.tf b/versions.tf index bedb556..e44f8db 100644 --- a/versions.tf +++ b/versions.tf @@ -19,7 +19,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 3.53, < 6" + version = ">= 4.23, < 6" } random = { source = "hashicorp/random"