fixed proj creation and readme

This commit is contained in:
Maurizio Noseda Pedraglio 2022-10-28 15:55:47 +02:00
parent 5b3262172d
commit fe29b9397a
4 changed files with 13 additions and 10 deletions

View File

@ -17,9 +17,10 @@ Clone this repository, then go through the following steps to create resources:
- Create a terraform.tfvars file with the following content: - Create a terraform.tfvars file with the following content:
- organization_id = "<YOUR-ORG-ID>" - organization_id = "<YOUR-ORG-ID>"
- billing_account = "<YOUR-BILLING-ACCOUNT>" - billing_account = "<YOUR-BILLING-ACCOUNT>"
- monitoring_project_id = "project-0" # Monitoring project where the dashboard will be created and the solution deployed - 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_projects_list = ["project-1", "project2"] # Projects to be monitored by the solution
- monitored_folders_list = ["folder_id"] # Folders 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 - v2 = true|false # Set to true to use V2 Cloud Functions environment
- `terraform init` - `terraform init`
- `terraform apply` - `terraform apply`

View File

@ -30,7 +30,7 @@ locals {
module "project-monitoring" { module "project-monitoring" {
count = var.monitoring_project_id == "" ? 1 : 0 count = var.monitoring_project_id == "" ? 1 : 0
source = "../../../modules/project" source = "../../../modules/project"
name = "monitoring" name = "network-dashboards"
parent = "organizations/${var.organization_id}" parent = "organizations/${var.organization_id}"
prefix = var.prefix prefix = var.prefix
billing_account = var.billing_account billing_account = var.billing_account
@ -184,4 +184,4 @@ module "cloud-function" {
resource "google_monitoring_dashboard" "dashboard" { resource "google_monitoring_dashboard" "dashboard" {
dashboard_json = file("${path.module}/dashboards/quotas-utilization.json") dashboard_json = file("${path.module}/dashboards/quotas-utilization.json")
project = local.monitoring_project project = local.monitoring_project
} }

View File

@ -29,16 +29,11 @@ variable "prefix" {
variable "project_vm_services" { variable "project_vm_services" {
description = "Service APIs enabled by default in new projects." description = "Service APIs enabled by default in new projects."
default = [ default = [
"cloudasset.googleapis.com",
"cloudbilling.googleapis.com", "cloudbilling.googleapis.com",
"cloudfunctions.googleapis.com",
"cloudscheduler.googleapis.com",
"compute.googleapis.com", "compute.googleapis.com",
"logging.googleapis.com", "logging.googleapis.com",
"monitoring.googleapis.com", "monitoring.googleapis.com",
"pubsub.googleapis.com",
"servicenetworking.googleapis.com", "servicenetworking.googleapis.com",
"storage-component.googleapis.com"
] ]
} }

View File

@ -50,8 +50,10 @@ variable "organization_id" {
variable "prefix" { variable "prefix" {
description = "Customer name to use as prefix for monitoring project" description = "Customer name to use as prefix for monitoring project"
default = "mon"
} }
variable "project_monitoring_services" { variable "project_monitoring_services" {
description = "Service APIs enabled in the monitoring project if it will be created." description = "Service APIs enabled in the monitoring project if it will be created."
default = [ default = [
@ -59,19 +61,24 @@ variable "project_monitoring_services" {
"cloudasset.googleapis.com", "cloudasset.googleapis.com",
"cloudbilling.googleapis.com", "cloudbilling.googleapis.com",
"cloudbuild.googleapis.com", "cloudbuild.googleapis.com",
"cloudfunctions.googleapis.com",
"cloudresourcemanager.googleapis.com", "cloudresourcemanager.googleapis.com",
"cloudscheduler.googleapis.com", "cloudscheduler.googleapis.com",
"compute.googleapis.com", "compute.googleapis.com",
"cloudfunctions.googleapis.com",
"iam.googleapis.com", "iam.googleapis.com",
"iamcredentials.googleapis.com", "iamcredentials.googleapis.com",
"logging.googleapis.com", "logging.googleapis.com",
"monitoring.googleapis.com", "monitoring.googleapis.com",
"pubsub.googleapis.com",
"run.googleapis.com", "run.googleapis.com",
"serviceusage.googleapis.com" "servicenetworking.googleapis.com",
"serviceusage.googleapis.com",
"storage-component.googleapis.com"
] ]
} }
variable "region" { variable "region" {
description = "Region used to deploy the cloud functions and scheduler" description = "Region used to deploy the cloud functions and scheduler"
default = "europe-west1" default = "europe-west1"