diff --git a/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/README.md b/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/README.md
index aa0bdf42e1..72dff9b0b5 100644
--- a/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/README.md
+++ b/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/README.md
@@ -64,17 +64,18 @@ dashboard_json_path = "../dashboards/quotas-utilization.json"
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
-| [discovery_config](variables.tf#L44) | Discovery configuration. Discovery root is the organization or a folder. If monitored folders and projects are empy, every project under the discovery root node will be monitored. | object({…})
| ✓ | |
-| [project_id](variables.tf#L90) | Project id where the Cloud Function will be deployed. | string
| ✓ | |
+| [discovery_config](variables.tf#L48) | Discovery configuration. Discovery root is the organization or a folder. If monitored folders and projects are empy, every project under the discovery root node will be monitored. | object({…})
| ✓ | |
+| [project_id](variables.tf#L100) | Project id where the Cloud Function will be deployed. | string
| ✓ | |
| [bundle_path](variables.tf#L17) | Path used to write the intermediate Cloud Function code bundle. | string
| | "./bundle.zip"
|
-| [cloud_function_config](variables.tf#L23) | Optional Cloud Function configuration. | object({…})
| | {}
|
-| [dashboard_json_path](variables.tf#L38) | Optional monitoring dashboard to deploy. | string
| | null
|
-| [grant_discovery_iam_roles](variables.tf#L62) | Optionally grant required IAM roles to Cloud Function service account. | bool
| | false
|
-| [labels](variables.tf#L69) | Billing labels used for the Cloud Function, and the project if project_create is true. | map(string)
| | {}
|
-| [name](variables.tf#L75) | Name used to create Cloud Function related resources. | string
| | "net-dash"
|
-| [project_create_config](variables.tf#L81) | Optional configuration if project creation is required. | object({…})
| | null
|
-| [region](variables.tf#L95) | Compute region where the Cloud Function will be deployed. | string
| | "europe-west1"
|
-| [schedule_config](variables.tf#L101) | Schedule timer configuration in crontab format. | string
| | "*/30 * * * *"
|
+| [cloud_function_config](variables.tf#L23) | Optional Cloud Function configuration. | object({…})
| | {}
|
+| [dashboard_json_path](variables.tf#L42) | Optional monitoring dashboard to deploy. | string
| | null
|
+| [grant_discovery_iam_roles](variables.tf#L66) | Optionally grant required IAM roles to Cloud Function service account. | bool
| | false
|
+| [labels](variables.tf#L73) | Billing labels used for the Cloud Function, and the project if project_create is true. | map(string)
| | {}
|
+| [monitoring_project](variables.tf#L79) | Project where generated metrics will be written. Default is to use the same project where the Cloud Function is deployed. | string
| | null
|
+| [name](variables.tf#L85) | Name used to create Cloud Function related resources. | string
| | "net-dash"
|
+| [project_create_config](variables.tf#L91) | Optional configuration if project creation is required. | object({…})
| | null
|
+| [region](variables.tf#L105) | Compute region where the Cloud Function will be deployed. | string
| | "europe-west1"
|
+| [schedule_config](variables.tf#L111) | Schedule timer configuration in crontab format. | string
| | "*/30 * * * *"
|
## Outputs
diff --git a/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/main.tf b/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/main.tf
index abbea80e29..c3d22f6b90 100644
--- a/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/main.tf
+++ b/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/main.tf
@@ -81,6 +81,15 @@ module "cloud-function" {
resource = module.pubsub.topic.id
}
}
+ vpc_connector = (
+ var.cloud_function_config.vpc_connector == null
+ ? null
+ : {
+ create = false
+ name = var.cloud_function_config.vpc_connector.name
+ egress_settings = var.cloud_function_config.vpc_connector.egress_settings
+ }
+ )
}
resource "google_cloud_scheduler_job" "default" {
@@ -94,10 +103,14 @@ resource "google_cloud_scheduler_job" "default" {
attributes = {}
topic_name = module.pubsub.topic.id
data = base64encode(jsonencode({
- discovery_root = var.discovery_config.discovery_root
- folders = var.discovery_config.monitored_folders
- projects = var.discovery_config.monitored_projects
- monitoring_project = module.project.project_id
+ discovery_root = var.discovery_config.discovery_root
+ folders = var.discovery_config.monitored_folders
+ projects = var.discovery_config.monitored_projects
+ monitoring_project = (
+ var.monitoring_project == null
+ ? module.project.project_id
+ : var.monitoring_project
+ )
custom_quota = (
var.discovery_config.custom_quota_file == null
? { networks = {}, projects = {} }
diff --git a/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/variables.tf b/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/variables.tf
index 680b689dd8..8cc64e1f2a 100644
--- a/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/variables.tf
+++ b/blueprints/cloud-operations/network-dashboard/deploy-cloud-function/variables.tf
@@ -30,6 +30,10 @@ variable "cloud_function_config" {
memory_mb = optional(number, 256)
source_dir = optional(string, "../src")
timeout_seconds = optional(number, 540)
+ vpc_connector = optional(object({
+ name = string
+ egress_settings = optional(string, "ALL_TRAFFIC")
+ }))
})
default = {}
nullable = false
@@ -72,6 +76,12 @@ variable "labels" {
default = {}
}
+variable "monitoring_project" {
+ description = "Project where generated metrics will be written. Default is to use the same project where the Cloud Function is deployed."
+ type = string
+ default = null
+}
+
variable "name" {
description = "Name used to create Cloud Function related resources."
type = string