Allow to specify function egress settings without using a VPC connector (#2967)
This commit is contained in:
@@ -331,8 +331,8 @@ module "cf-http" {
|
||||
| [service_account](variables.tf#L185) | Service account email. Unused if service account is auto-created. | <code>string</code> | | <code>null</code> |
|
||||
| [service_account_create](variables.tf#L191) | Auto-create service account. | <code>bool</code> | | <code>false</code> |
|
||||
| [trigger_config](variables.tf#L197) | Function trigger configuration. Leave null for HTTP trigger. | <code title="object({ event_type = string pubsub_topic = optional(string) region = optional(string) event_filters = optional(list(object({ attribute = string value = string operator = optional(string) })), []) service_account_email = optional(string) service_account_create = optional(bool, false) retry_policy = optional(string, "RETRY_POLICY_DO_NOT_RETRY") # default to avoid permadiff })">object({…})</code> | | <code>null</code> |
|
||||
| [vpc_connector](variables.tf#L215) | VPC connector configuration. Set create to 'true' if a new connector needs to be created. | <code title="object({ create = bool name = string egress_settings = string })">object({…})</code> | | <code>null</code> |
|
||||
| [vpc_connector_config](variables.tf#L225) | VPC connector network configuration. Must be provided if new VPC connector is being created. | <code title="object({ ip_cidr_range = string network = string instances = optional(object({ max = optional(number) min = optional(number, 2) })) throughput = optional(object({ max = optional(number, 300) min = optional(number, 200) })) })">object({…})</code> | | <code>null</code> |
|
||||
| [vpc_connector](variables.tf#L215) | VPC connector configuration. Set create to 'true' if a new connector needs to be created. | <code title="object({ create = optional(bool, false) name = optional(string) egress_settings = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [vpc_connector_config](variables.tf#L226) | VPC connector network configuration. Must be provided if new VPC connector is being created. | <code title="object({ ip_cidr_range = string network = string instances = optional(object({ max = optional(number) min = optional(number, 2) })) throughput = optional(object({ max = optional(number, 300) min = optional(number, 200) })) })">object({…})</code> | | <code>null</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ locals {
|
||||
null
|
||||
)
|
||||
vpc_connector = (
|
||||
var.vpc_connector == null
|
||||
var.vpc_connector.name == null
|
||||
? null
|
||||
: (
|
||||
try(var.vpc_connector.create, false) == false
|
||||
var.vpc_connector.create == false
|
||||
? var.vpc_connector.name
|
||||
: google_vpc_access_connector.connector[0].id
|
||||
)
|
||||
@@ -50,7 +50,7 @@ locals {
|
||||
}
|
||||
|
||||
resource "google_vpc_access_connector" "connector" {
|
||||
count = try(var.vpc_connector.create, false) == true ? 1 : 0
|
||||
count = var.vpc_connector.create == true ? 1 : 0
|
||||
project = var.project_id
|
||||
name = var.vpc_connector.name
|
||||
region = var.region
|
||||
@@ -121,8 +121,7 @@ resource "google_cloudfunctions2_function" "function" {
|
||||
all_traffic_on_latest_revision = true
|
||||
service_account_email = local.service_account_email
|
||||
vpc_connector = local.vpc_connector
|
||||
vpc_connector_egress_settings = try(
|
||||
var.vpc_connector.egress_settings, null)
|
||||
vpc_connector_egress_settings = var.vpc_connector.egress_settings
|
||||
|
||||
dynamic "secret_environment_variables" {
|
||||
for_each = { for k, v in var.secrets : k => v if !v.is_volume }
|
||||
|
||||
@@ -215,11 +215,12 @@ variable "trigger_config" {
|
||||
variable "vpc_connector" {
|
||||
description = "VPC connector configuration. Set create to 'true' if a new connector needs to be created."
|
||||
type = object({
|
||||
create = bool
|
||||
name = string
|
||||
egress_settings = string
|
||||
create = optional(bool, false)
|
||||
name = optional(string)
|
||||
egress_settings = optional(string)
|
||||
})
|
||||
default = null
|
||||
nullable = false
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "vpc_connector_config" {
|
||||
|
||||
Reference in New Issue
Block a user