From 6e97c09d1f7f6876608feca110652c5024f6d1cf Mon Sep 17 00:00:00 2001 From: Amanda Karina Lopes de Oliveira Date: Wed, 9 Dec 2020 14:18:18 -0300 Subject: [PATCH 1/6] Adds support to vpc_connector_egress_settings --- README.md | 1 + main.tf | 17 +++++++++-------- variables.tf | 6 ++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 78079cd..9b4deb4 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ module "localhost_function" { | source\_directory | The pathname of the directory which contains the function source code. | string | n/a | yes | | timeout\_s | The amount of time in seconds allotted for the execution of the function. | number | `"60"` | no | | vpc\_connector | The VPC Network Connector that this cloud function can connect to. It should be set up as fully-qualified URI. The format of this field is projects/*/locations/*/connectors/*. | string | `"null"` | no | +| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. | string | `"ALLOW_ALL"` | no | ## Outputs diff --git a/main.tf b/main.tf index 9dfbf6b..c86a583 100644 --- a/main.tf +++ b/main.tf @@ -68,14 +68,15 @@ resource "google_storage_bucket_object" "main" { } resource "google_cloudfunctions_function" "main" { - name = var.name - description = var.description - available_memory_mb = var.available_memory_mb - max_instances = var.max_instances - timeout = var.timeout_s - entry_point = var.entry_point - ingress_settings = var.ingress_settings - vpc_connector = var.vpc_connector + name = var.name + description = var.description + available_memory_mb = var.available_memory_mb + max_instances = var.max_instances + timeout = var.timeout_s + entry_point = var.entry_point + ingress_settings = var.ingress_settings + vpc_connector_egress_settings = var.vpc_connector_egress_settings + vpc_connector = var.vpc_connector event_trigger { event_type = var.event_trigger["event_type"] diff --git a/variables.tf b/variables.tf index 118b39d..b4b3b9a 100644 --- a/variables.tf +++ b/variables.tf @@ -136,6 +136,12 @@ variable "ingress_settings" { description = "The ingress settings for the function" } +variable "vpc_connector_egress_settings" { + type = string + default = "ALLOW_ALL" + description = "The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY." +} + variable "vpc_connector" { type = string default = null From 3732794b912ecf95ce3eeb282e59a7c2b1b4e612 Mon Sep 17 00:00:00 2001 From: Amanda Karina Lopes de Oliveira Date: Wed, 9 Dec 2020 14:43:28 -0300 Subject: [PATCH 2/6] Fixes default value --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index b4b3b9a..807b2e1 100644 --- a/variables.tf +++ b/variables.tf @@ -138,7 +138,7 @@ variable "ingress_settings" { variable "vpc_connector_egress_settings" { type = string - default = "ALLOW_ALL" + default = "ALL_TRAFFIC" description = "The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY." } From cef51c57b541a96d5d9f21fb72915e6cdbd3ede4 Mon Sep 17 00:00:00 2001 From: Amanda Karina Lopes de Oliveira Date: Wed, 9 Dec 2020 14:54:26 -0300 Subject: [PATCH 3/6] Updates README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b4deb4..c3d2920 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ module "localhost_function" { | source\_directory | The pathname of the directory which contains the function source code. | string | n/a | yes | | timeout\_s | The amount of time in seconds allotted for the execution of the function. | number | `"60"` | no | | vpc\_connector | The VPC Network Connector that this cloud function can connect to. It should be set up as fully-qualified URI. The format of this field is projects/*/locations/*/connectors/*. | string | `"null"` | no | -| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. | string | `"ALLOW_ALL"` | no | +| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. | string | `"ALL_TRAFFIC"` | no | ## Outputs From 51a063c12b067c0afe54015b227559cfa0051796 Mon Sep 17 00:00:00 2001 From: Amanda Karina Lopes de Oliveira Date: Wed, 9 Dec 2020 14:57:46 -0300 Subject: [PATCH 4/6] Changes default and description to be similar to resource --- README.md | 4 ++-- variables.tf | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c3d2920..60f3071 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ module "localhost_function" { | 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) | n/a | yes | | event\_trigger\_failure\_policy\_retry | A toggle to determine if the function should be retried on failure. | bool | `"false"` | no | -| ingress\_settings | The ingress settings for the function | string | `"ALLOW_ALL"` | 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 | | labels | A set of key/value label pairs to assign to the Cloud Function. | map(string) | `` | no | | max\_instances | The maximum number of parallel executions of the function. | number | `"0"` | no | | name | The name to apply to any nameable resources. | string | n/a | yes | @@ -73,7 +73,7 @@ module "localhost_function" { | source\_directory | The pathname of the directory which contains the function source code. | string | n/a | yes | | timeout\_s | The amount of time in seconds allotted for the execution of the function. | number | `"60"` | no | | vpc\_connector | The VPC Network Connector that this cloud function can connect to. It should be set up as fully-qualified URI. The format of this field is projects/*/locations/*/connectors/*. | string | `"null"` | no | -| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. | string | `"ALL_TRAFFIC"` | no | +| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value. | string | `"PRIVATE_RANGES_ONLY"` | no | ## Outputs diff --git a/variables.tf b/variables.tf index 807b2e1..c696f54 100644 --- a/variables.tf +++ b/variables.tf @@ -133,13 +133,13 @@ variable "event_trigger_failure_policy_retry" { variable "ingress_settings" { type = string default = "ALLOW_ALL" - description = "The ingress settings for the function" + 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 "vpc_connector_egress_settings" { type = string - default = "ALL_TRAFFIC" - description = "The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY." + default = "PRIVATE_RANGES_ONLY" + description = "The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value." } variable "vpc_connector" { From 10e10df3f77014ed403385ae5f9d5da889e380c8 Mon Sep 17 00:00:00 2001 From: Amanda Karina Lopes de Oliveira Date: Wed, 9 Dec 2020 15:15:28 -0300 Subject: [PATCH 5/6] Changes default value --- README.md | 2 +- variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 60f3071..7fdd613 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ module "localhost_function" { | source\_directory | The pathname of the directory which contains the function source code. | string | n/a | yes | | timeout\_s | The amount of time in seconds allotted for the execution of the function. | number | `"60"` | no | | vpc\_connector | The VPC Network Connector that this cloud function can connect to. It should be set up as fully-qualified URI. The format of this field is projects/*/locations/*/connectors/*. | string | `"null"` | no | -| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value. | string | `"PRIVATE_RANGES_ONLY"` | no | +| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value. | string | `""` | no | ## Outputs diff --git a/variables.tf b/variables.tf index c696f54..47d5fd1 100644 --- a/variables.tf +++ b/variables.tf @@ -138,7 +138,7 @@ variable "ingress_settings" { variable "vpc_connector_egress_settings" { type = string - default = "PRIVATE_RANGES_ONLY" + default = "" description = "The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value." } From 215a96d91896832c4e9c3cc506249b96549f7262 Mon Sep 17 00:00:00 2001 From: Amanda Karina Lopes de Oliveira Date: Wed, 9 Dec 2020 15:16:37 -0300 Subject: [PATCH 6/6] Changes default value --- README.md | 2 +- variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7fdd613..38e85c2 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ module "localhost_function" { | source\_directory | The pathname of the directory which contains the function source code. | string | n/a | yes | | timeout\_s | The amount of time in seconds allotted for the execution of the function. | number | `"60"` | no | | vpc\_connector | The VPC Network Connector that this cloud function can connect to. It should be set up as fully-qualified URI. The format of this field is projects/*/locations/*/connectors/*. | string | `"null"` | no | -| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value. | string | `""` | no | +| vpc\_connector\_egress\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value. | string | `"null"` | no | ## Outputs diff --git a/variables.tf b/variables.tf index 47d5fd1..5229486 100644 --- a/variables.tf +++ b/variables.tf @@ -138,7 +138,7 @@ variable "ingress_settings" { variable "vpc_connector_egress_settings" { type = string - default = "" + default = null description = "The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value." }