service_account_config for Cloud Run v2
Additional changes: * align vpc-connector interface to Cloud Functions * split managed and unmanaged resources into separate files, this makes easier to introduce further changes * add support for contexts * move `vpc_connector` variable to variables.tf for Cloud Functions * remove `create` from `vpc_connector` in Cloud Functions as it was sharing the meaning with `vpc_connector_create`
This commit is contained in:
@@ -500,8 +500,8 @@ module "cf_http" {
|
||||
| [secrets](variables.tf#L194) | Secret Manager secrets. Key is the variable name or mountpoint, volume versions are in version:path format. | <code title="map(object({ is_volume = bool project_id = string secret = string versions = list(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [service_account_config](variables-serviceaccount.tf#L17) | Service account configurations. | <code title="object({ create = optional(bool, true) display_name = optional(string) email = optional(string) name = optional(string) roles = optional(list(string), [ "roles/logging.logWriter", "roles/monitoring.metricWriter" ]) })">object({…})</code> | | <code>{}</code> |
|
||||
| [trigger_config](variables.tf#L206) | Function trigger configuration. Leave null for HTTP trigger. | <code title="object({ event = string resource = string retry = optional(bool) })">object({…})</code> | | <code>null</code> |
|
||||
| [vpc_connector](variables-vpcconnector.tf#L17) | 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_create](variables-vpcconnector.tf#L28) | VPC connector network configuration. Must be provided if new VPC connector is being created. | <code title="object({ ip_cidr_range = optional(string) machine_type = optional(string) name = optional(string) network = optional(string) instances = optional(object({ max = optional(number) min = optional(number) }), {} ) throughput = optional(object({ max = optional(number) min = optional(number) }), {} ) subnet = optional(object({ name = optional(string) project_id = optional(string) }), {}) })">object({…})</code> | | <code>null</code> |
|
||||
| [vpc_connector](variables.tf#L216) | VPC connector configuration. Set create to 'true' if a new connector needs to be created. | <code title="object({ name = optional(string) egress_settings = optional(string) })">object({…})</code> | | <code>{}</code> |
|
||||
| [vpc_connector_create](variables-vpcconnector.tf#L17) | VPC connector network configuration. Must be provided if new VPC connector is being created. | <code title="object({ ip_cidr_range = optional(string) machine_type = optional(string) name = optional(string) network = optional(string) instances = optional(object({ max = optional(number) min = optional(number) }), {} ) throughput = optional(object({ max = optional(number) min = optional(number) }), {} ) subnet = optional(object({ name = optional(string) project_id = optional(string) }), {}) })">object({…})</code> | | <code>null</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ locals {
|
||||
location = lookup(local.ctx.locations, var.region, var.region)
|
||||
prefix = var.prefix == null ? "" : "${var.prefix}-"
|
||||
project_id = lookup(local.ctx.project_ids, var.project_id, var.project_id)
|
||||
vpc_connector = var.vpc_connector.create ? google_vpc_access_connector.connector[0].id : var.vpc_connector.name
|
||||
vpc_connector = var.vpc_connector_create != null ? google_vpc_access_connector.connector[0].id : var.vpc_connector.name
|
||||
}
|
||||
|
||||
resource "google_cloudfunctions_function" "function" {
|
||||
|
||||
@@ -14,17 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
variable "vpc_connector" {
|
||||
description = "VPC connector configuration. Set create to 'true' if a new connector needs to be created."
|
||||
type = object({
|
||||
create = optional(bool, false)
|
||||
name = optional(string)
|
||||
egress_settings = optional(string)
|
||||
})
|
||||
nullable = false
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "vpc_connector_create" {
|
||||
description = "VPC connector network configuration. Must be provided if new VPC connector is being created."
|
||||
type = object({
|
||||
@@ -50,7 +39,7 @@ variable "vpc_connector_create" {
|
||||
default = null
|
||||
validation {
|
||||
condition = (
|
||||
var.vpc_connector.create == false ||
|
||||
var.vpc_connector_create == null ||
|
||||
try(var.vpc_connector_create.instances, null) != null ||
|
||||
try(var.vpc_connector_create.throughput, null) != null
|
||||
)
|
||||
|
||||
@@ -212,3 +212,13 @@ variable "trigger_config" {
|
||||
})
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "vpc_connector" {
|
||||
description = "VPC connector configuration. Set create to 'true' if a new connector needs to be created."
|
||||
type = object({
|
||||
name = optional(string)
|
||||
egress_settings = optional(string)
|
||||
})
|
||||
nullable = false
|
||||
default = {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user