fixed conditional creation and updated readme
This commit is contained in:
parent
8b7bf698d2
commit
10811b3d31
|
@ -28,7 +28,7 @@ Labels are set with project id (which may differ from the monitoring workspace p
|
|||
|
||||
<img src="explorer.png" width="640px" alt="GCP Metrics Explorer, usage, limit and utilization view sample">
|
||||
|
||||
The solution also creates a basic monitoring alert policy, to demonstrate how to raise alerts when quotas utilization goes over a predefined threshold.
|
||||
The solution can also create a basic monitoring alert policy, to demonstrate how to raise alerts when quotas utilization goes over a predefined threshold, to enable it, set variable `alert_create` to true and reapply main.tf after main.py has run at least one and quota monitoring metrics have been creaed.
|
||||
|
||||
## Running the blueprint
|
||||
|
||||
|
|
|
@ -106,8 +106,9 @@ resource "google_project_iam_member" "quota_viewer" {
|
|||
member = module.cf.service_account_iam_email
|
||||
}
|
||||
|
||||
var.create_alert ? {
|
||||
|
||||
resource "google_monitoring_alert_policy" "alert_policy" {
|
||||
count = var.alert_create ? 1 : 0
|
||||
project = module.project.project_id
|
||||
display_name = "Quota monitor"
|
||||
combiner = "OR"
|
||||
|
@ -137,7 +138,7 @@ var.create_alert ? {
|
|||
content = "GCE cpus quota over threshold."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resource "random_pet" "random" {
|
||||
length = 1
|
||||
|
|
|
@ -14,18 +14,18 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
variable "alert_create" {
|
||||
description = "Enables the creation of a sample monitoring alert, false by default."
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "bundle_path" {
|
||||
description = "Path used to write the intermediate Cloud Function code bundle."
|
||||
type = string
|
||||
default = "./bundle.zip"
|
||||
}
|
||||
|
||||
variable "create_alert" {
|
||||
description = "Enables the creation of a sample monitoring alert, false by default."
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "name" {
|
||||
description = "Arbitrary string used to name created resources."
|
||||
type = string
|
||||
|
|
Loading…
Reference in New Issue