Skip to content

Commit 12beb96

Browse files
authored
feat(TPG >=4.23)!: Add docker_registry variables and use them in google_cloudfunctions_function resource (#164)
1 parent e05cbce commit 12beb96

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ module "localhost_function" {
6060
| build\_environment\_variables | A set of key/value environment variable pairs available during build time. | `map(string)` | `{}` | no |
6161
| 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 |
6262
| description | The description of the function. | `string` | `"Processes events."` | no |
63+
| 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 |
64+
| 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 |
6365
| entry\_point | The name of a method in the function source which will be invoked when the function is executed. | `string` | n/a | yes |
6466
| environment\_variables | A set of key/value environment variable pairs to assign to the function. | `map(string)` | `{}` | no |
6567
| event\_trigger | A source that fires events in response to a condition in another service. | `map(string)` | `{}` | no |
6668
| event\_trigger\_failure\_policy\_retry | A toggle to determine if the function should be retried on failure. | `bool` | `false` | no |
6769
| files\_to\_exclude\_in\_source\_dir | Specify files to ignore when reading the source\_dir | `list(string)` | `[]` | no |
6870
| 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 |
71+
| kms\_key\_name | Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources. | `string` | `null` | no |
6972
| labels | A set of key/value label pairs to assign to the Cloud Function. | `map(string)` | `{}` | no |
7073
| log\_bucket | Log bucket | `string` | `null` | no |
7174
| log\_object\_prefix | Log object prefix | `string` | `null` | no |

main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,7 @@ resource "google_cloudfunctions_function" "main" {
144144
region = var.region
145145
service_account_email = var.service_account_email
146146
build_environment_variables = var.build_environment_variables
147+
docker_registry = var.docker_registry
148+
docker_repository = var.docker_repository
149+
kms_key_name = var.kms_key_name
147150
}

variables.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,22 @@ variable "build_environment_variables" {
184184
default = {}
185185
description = "A set of key/value environment variable pairs available during build time."
186186
}
187+
188+
variable "docker_registry" {
189+
type = string
190+
default = null
191+
description = "Docker Registry to use for storing the function's Docker images. Allowed values are CONTAINER_REGISTRY (default) and ARTIFACT_REGISTRY."
192+
}
193+
194+
variable "docker_repository" {
195+
type = string
196+
default = null
197+
description = "User managed repository created in Artifact Registry optionally with a customer managed encryption key. If specified, deployments will use Artifact Registry."
198+
}
199+
200+
201+
variable "kms_key_name" {
202+
type = string
203+
default = null
204+
description = "Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources."
205+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ terraform {
2020

2121
google = {
2222
source = "hashicorp/google"
23-
version = ">= 4.11, < 5.0"
23+
version = ">= 4.23, < 5.0"
2424
}
2525
null = {
2626
source = "hashicorp/null"

0 commit comments

Comments
 (0)