addressed #599 comments
This commit is contained in:
@@ -16,13 +16,17 @@ Three metric descriptors are created for each monitored resource: usage, limit a
|
||||
Clone this repository, then go through the following steps to create resources:
|
||||
- Create a terraform.tfvars file with the following content:
|
||||
```tfvars
|
||||
- organization_id = "<YOUR-ORG-ID>"
|
||||
- billing_account = "<YOUR-BILLING-ACCOUNT>"
|
||||
- monitoring_project_id = "<YOUR-MONITORING-PROJECT>" # Monitoring project where the dashboard will be created and the solution deployed, a project named "mon-network-dahshboard" will be created if left blank
|
||||
- monitored_projects_list = ["project-1", "project2"] # Projects to be monitored by the solution
|
||||
- monitored_folders_list = ["folder_id"] # Folders to be monitored by the solution
|
||||
- prefix = "<YOUR-PREFIX>" # Monitoring project name prefix, monitoring project name is <YOUR-PREFIX>-network-dashboard, ignored if monitoring_project_id variable is provided
|
||||
- v2 = true|false # Set to true to use V2 Cloud Functions environment
|
||||
organization_id = "<YOUR-ORG-ID>"
|
||||
billing_account = "<YOUR-BILLING-ACCOUNT>"
|
||||
monitoring_project_id = "<YOUR-MONITORING-PROJECT>"
|
||||
# Monitoring project where the dashboard will be created and the solution deployed, a project named "mon-network-dahshboard" will be created if left blank
|
||||
monitored_projects_list = ["project-1", "project2"]
|
||||
# Projects to be monitored by the solution
|
||||
monitored_folders_list = ["folder_id"]
|
||||
# Folders to be monitored by the solution
|
||||
prefix = "<YOUR-PREFIX>"
|
||||
# Monitoring project name prefix, monitoring project name is <YOUR-PREFIX>-network-dashboard, ignored if monitoring_project_id variable is provided
|
||||
v2 = true|false # Set to true to use V2 Cloud Functions environment
|
||||
```
|
||||
- `terraform init`
|
||||
- `terraform apply`
|
||||
@@ -87,15 +91,13 @@ If you are interested in this and/or would like to contribute, please contact le
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [billing_account](variables.tf#L17) | The ID of the billing account to associate this project with | <code></code> | ✓ | |
|
||||
| [monitored_projects_list](variables.tf#L36) | ID of the projects to be monitored (where limits and quotas data will be pulled) | <code>list(string)</code> | ✓ | |
|
||||
| [organization_id](variables.tf#L54) | The organization id for the associated services | <code></code> | ✓ | |
|
||||
| [prefix](variables.tf#L58) | Customer name to use as prefix for monitoring project | <code></code> | ✓ | |
|
||||
| [organization_id](variables.tf#L46) | The organization id for the associated services | <code></code> | ✓ | |
|
||||
| [prefix](variables.tf#L50) | Customer name to use as prefix for monitoring project | <code></code> | ✓ | |
|
||||
| [cf_version](variables.tf#L21) | Cloud Function version 2nd Gen or 1st Gen. Possible options: 'V1' or 'V2'.Use CFv2 if your Cloud Function timeouts after 9 minutes. By default it is using CFv1. | <code></code> | | <code>V1</code> |
|
||||
| [metrics_project_id](variables.tf#L46) | Optional, populate to write metrics and deploy the dashboard in a separated project | <code></code> | | |
|
||||
| [monitored_folders_list](variables.tf#L30) | ID of the projects to be monitored (where limits and quotas data will be pulled) | <code>list(string)</code> | | <code>[]</code> |
|
||||
| [monitoring_project_id](variables.tf#L41) | Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string, if metrics_project_id is provided, metrics and dashboard will be deployed there | <code></code> | | |
|
||||
| [project_monitoring_services](variables.tf#L63) | Service APIs enabled in the monitoring project if it will be created. | <code></code> | | <code title="[ "artifactregistry.googleapis.com", "cloudasset.googleapis.com", "cloudbilling.googleapis.com", "cloudbuild.googleapis.com", "cloudfunctions.googleapis.com", "cloudresourcemanager.googleapis.com", "cloudscheduler.googleapis.com", "compute.googleapis.com", "iam.googleapis.com", "iamcredentials.googleapis.com", "logging.googleapis.com", "monitoring.googleapis.com", "pubsub.googleapis.com", "run.googleapis.com", "servicenetworking.googleapis.com", "serviceusage.googleapis.com", "storage-component.googleapis.com" ]">[…]</code> |
|
||||
| [region](variables.tf#L88) | Region used to deploy the cloud functions and scheduler | <code></code> | | <code>europe-west1</code> |
|
||||
| [schedule_cron](variables.tf#L93) | Cron format schedule to run the Cloud Function. Default is every 10 minutes. | <code></code> | | <code>*/10 * * * *</code> |
|
||||
| [vpc_connector_name](variables.tf#L99) | Serverless VPC connection name for the Cloud Function | <code></code> | | |
|
||||
| [project_monitoring_services](variables.tf#L54) | Service APIs enabled in the monitoring project if it will be created. | <code></code> | | <code title="[ "artifactregistry.googleapis.com", "cloudasset.googleapis.com", "cloudbilling.googleapis.com", "cloudbuild.googleapis.com", "cloudfunctions.googleapis.com", "cloudresourcemanager.googleapis.com", "cloudscheduler.googleapis.com", "compute.googleapis.com", "iam.googleapis.com", "iamcredentials.googleapis.com", "logging.googleapis.com", "monitoring.googleapis.com", "pubsub.googleapis.com", "run.googleapis.com", "servicenetworking.googleapis.com", "serviceusage.googleapis.com", "storage-component.googleapis.com" ]">[…]</code> |
|
||||
| [region](variables.tf#L76) | Region used to deploy the cloud functions and scheduler | <code></code> | | <code>europe-west1</code> |
|
||||
| [schedule_cron](variables.tf#L81) | Cron format schedule to run the Cloud Function. Default is every 10 minutes. | <code></code> | | <code>*/10 * * * *</code> |
|
||||
|
||||
<!-- END TFDOC -->
|
||||
|
||||
@@ -21,7 +21,6 @@ locals {
|
||||
folder_ids = toset(var.monitored_folders_list)
|
||||
folders = join(",", local.folder_ids)
|
||||
monitoring_project = var.monitoring_project_id == "" ? module.project-monitoring[0].project_id : var.monitoring_project_id
|
||||
metrics_project = var.metrics_project_id == "" ? (var.monitoring_project_id == "" ? module.project-monitoring[0].project_id : var.monitoring_project_id) : var.metrics_project_id
|
||||
}
|
||||
|
||||
################################################
|
||||
@@ -61,7 +60,7 @@ module "service-account-function" {
|
||||
}
|
||||
|
||||
iam_project_roles = {
|
||||
"${local.metrics_project}" = [
|
||||
"${local.monitoring_project}" = [
|
||||
"roles/monitoring.metricWriter",
|
||||
]
|
||||
}
|
||||
@@ -168,7 +167,7 @@ module "cloud-function" {
|
||||
environment_variables = {
|
||||
MONITORED_PROJECTS_LIST = local.projects
|
||||
MONITORED_FOLDERS_LIST = local.folders
|
||||
MONITORING_PROJECT_ID = local.metrics_project
|
||||
MONITORING_PROJECT_ID = local.monitoring_project
|
||||
ORGANIZATION_ID = var.organization_id
|
||||
CF_VERSION = var.cf_version
|
||||
}
|
||||
@@ -190,9 +189,5 @@ module "cloud-function" {
|
||||
|
||||
resource "google_monitoring_dashboard" "dashboard" {
|
||||
dashboard_json = file("${path.module}/dashboards/quotas-utilization.json")
|
||||
<<<<<<< HEAD
|
||||
project = local.metrics_project
|
||||
=======
|
||||
project = local.monitoring_project
|
||||
>>>>>>> b7bfcf3575cda18a2fdd2862c72e33c1648c0aa4
|
||||
}
|
||||
|
||||
@@ -43,24 +43,14 @@ variable "monitoring_project_id" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "metrics_project_id" {
|
||||
description = "Optional, populate to write metrics and deploy the dashboard in a separated project"
|
||||
default = ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
variable "organization_id" {
|
||||
description = "The organization id for the associated services"
|
||||
}
|
||||
|
||||
variable "prefix" {
|
||||
description = "Customer name to use as prefix for monitoring project"
|
||||
default = "mon"
|
||||
}
|
||||
|
||||
|
||||
variable "project_monitoring_services" {
|
||||
description = "Service APIs enabled in the monitoring project if it will be created."
|
||||
default = [
|
||||
@@ -83,9 +73,6 @@ variable "project_monitoring_services" {
|
||||
"storage-component.googleapis.com"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
variable "region" {
|
||||
description = "Region used to deploy the cloud functions and scheduler"
|
||||
default = "europe-west1"
|
||||
@@ -95,13 +82,3 @@ variable "schedule_cron" {
|
||||
description = "Cron format schedule to run the Cloud Function. Default is every 10 minutes."
|
||||
default = "*/10 * * * *"
|
||||
}
|
||||
|
||||
|
||||
variable "vpc_connector_name" {
|
||||
description = "Serverless VPC connection name for the Cloud Function"
|
||||
default = ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user