Skip to content

Commit 5d4d6ad

Browse files
authored
feat: Update repository-function module to support VPC connector (#73)
* Update repository-function module to support VPC connector, VPC connector egress, and ingress settings. * Documentation generation
1 parent a34c3f0 commit 5d4d6ad

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

modules/repository-function/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ is a tested reference of how to use this submodule with the
2323
| entry\_point | The name of a method in the function source which will be invoked when the function is executed. | string | n/a | yes |
2424
| environment\_variables | A set of key/value environment variable pairs to assign to the function. | map(string) | `<map>` | no |
2525
| event\_trigger | A source that fires events in response to a condition in another service. | map(string) | n/a | yes |
26+
| 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 |
2627
| labels | A set of key/value label pairs to assign to any lableable resources. | map(string) | `<map>` | no |
2728
| name | The name to apply to any nameable resources. | string | n/a | yes |
2829
| project\_id | The ID of the project to which resources will be applied. | string | n/a | yes |
2930
| region | The region in which resources will be applied. | string | n/a | yes |
3031
| runtime | The runtime in which the function will be executed. | string | `"nodejs6"` | no |
3132
| source\_repository\_url | The URL of the repository which contains the function source code. | string | n/a | yes |
3233
| timeout\_s | The amount of time in seconds allotted for the execution of the function. | number | `"60"` | no |
34+
| 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 |
35+
| 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 |
3336

3437
## Outputs
3538

modules/repository-function/main.tf

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
*/
1616

1717
resource "google_cloudfunctions_function" "main" {
18-
name = var.name
19-
description = var.description
20-
available_memory_mb = var.available_memory_mb
21-
timeout = var.timeout_s
22-
entry_point = var.entry_point
18+
name = var.name
19+
description = var.description
20+
available_memory_mb = var.available_memory_mb
21+
timeout = var.timeout_s
22+
entry_point = var.entry_point
23+
ingress_settings = var.ingress_settings
24+
vpc_connector_egress_settings = var.vpc_connector_egress_settings
25+
vpc_connector = var.vpc_connector
2326

2427
event_trigger {
2528
event_type = var.event_trigger["event_type"]

modules/repository-function/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,21 @@ variable "timeout_s" {
7979
default = 60
8080
description = "The amount of time in seconds allotted for the execution of the function."
8181
}
82+
83+
variable "ingress_settings" {
84+
type = string
85+
default = "ALLOW_ALL"
86+
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."
87+
}
88+
89+
variable "vpc_connector_egress_settings" {
90+
type = string
91+
default = null
92+
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."
93+
}
94+
95+
variable "vpc_connector" {
96+
type = string
97+
default = null
98+
description = "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/*."
99+
}

0 commit comments

Comments
 (0)