port mauri's changes to new code (#1274)
This commit is contained in:
parent
1af1c77ae8
commit
603d9045eb
|
@ -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. | <code title="object({ discovery_root = string monitored_folders = list(string) monitored_projects = list(string) custom_quota_file = optional(string) })">object({…})</code> | ✓ | |
|
||||
| [project_id](variables.tf#L90) | Project id where the Cloud Function will be deployed. | <code>string</code> | ✓ | |
|
||||
| [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. | <code title="object({ discovery_root = string monitored_folders = list(string) monitored_projects = list(string) custom_quota_file = optional(string) })">object({…})</code> | ✓ | |
|
||||
| [project_id](variables.tf#L100) | Project id where the Cloud Function will be deployed. | <code>string</code> | ✓ | |
|
||||
| [bundle_path](variables.tf#L17) | Path used to write the intermediate Cloud Function code bundle. | <code>string</code> | | <code>"./bundle.zip"</code> |
|
||||
| [cloud_function_config](variables.tf#L23) | Optional Cloud Function configuration. | <code title="object({ bucket_name = optional(string) build_worker_pool_id = optional(string) bundle_path = optional(string, "./bundle.zip") debug = optional(bool, false) memory_mb = optional(number, 256) source_dir = optional(string, "../src") timeout_seconds = optional(number, 540) })">object({…})</code> | | <code>{}</code> |
|
||||
| [dashboard_json_path](variables.tf#L38) | Optional monitoring dashboard to deploy. | <code>string</code> | | <code>null</code> |
|
||||
| [grant_discovery_iam_roles](variables.tf#L62) | Optionally grant required IAM roles to Cloud Function service account. | <code>bool</code> | | <code>false</code> |
|
||||
| [labels](variables.tf#L69) | Billing labels used for the Cloud Function, and the project if project_create is true. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [name](variables.tf#L75) | Name used to create Cloud Function related resources. | <code>string</code> | | <code>"net-dash"</code> |
|
||||
| [project_create_config](variables.tf#L81) | Optional configuration if project creation is required. | <code title="object({ billing_account_id = string parent_id = optional(string) })">object({…})</code> | | <code>null</code> |
|
||||
| [region](variables.tf#L95) | Compute region where the Cloud Function will be deployed. | <code>string</code> | | <code>"europe-west1"</code> |
|
||||
| [schedule_config](variables.tf#L101) | Schedule timer configuration in crontab format. | <code>string</code> | | <code>"*/30 * * * *"</code> |
|
||||
| [cloud_function_config](variables.tf#L23) | Optional Cloud Function configuration. | <code title="object({ bucket_name = optional(string) build_worker_pool_id = optional(string) bundle_path = optional(string, "./bundle.zip") debug = optional(bool, false) 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") })) })">object({…})</code> | | <code>{}</code> |
|
||||
| [dashboard_json_path](variables.tf#L42) | Optional monitoring dashboard to deploy. | <code>string</code> | | <code>null</code> |
|
||||
| [grant_discovery_iam_roles](variables.tf#L66) | Optionally grant required IAM roles to Cloud Function service account. | <code>bool</code> | | <code>false</code> |
|
||||
| [labels](variables.tf#L73) | Billing labels used for the Cloud Function, and the project if project_create is true. | <code>map(string)</code> | | <code>{}</code> |
|
||||
| [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. | <code>string</code> | | <code>null</code> |
|
||||
| [name](variables.tf#L85) | Name used to create Cloud Function related resources. | <code>string</code> | | <code>"net-dash"</code> |
|
||||
| [project_create_config](variables.tf#L91) | Optional configuration if project creation is required. | <code title="object({ billing_account_id = string parent_id = optional(string) })">object({…})</code> | | <code>null</code> |
|
||||
| [region](variables.tf#L105) | Compute region where the Cloud Function will be deployed. | <code>string</code> | | <code>"europe-west1"</code> |
|
||||
| [schedule_config](variables.tf#L111) | Schedule timer configuration in crontab format. | <code>string</code> | | <code>"*/30 * * * *"</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
|
|
@ -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 = {} }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue