-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the synthetic monitor target type as an option for uptime checks. (
#8709) * Adds synthetic_monitor type that lives alongside resource_group and monitored_resource * removes requirement for either tcp_check or http_check to be provided, as neither is required when synthetic_monitor is provided * Adds acceptance test, and example. A new test fixutre w/ zip file is provided for these flows.
- Loading branch information
Showing
3 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
mmv1/templates/terraform/examples/uptime_check_config_synthetic_monitor.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
resource "google_storage_bucket" "bucket" { | ||
name = "<%= ctx[:test_env_vars]["project_id"] %>-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique | ||
location = "US" | ||
uniform_bucket_level_access = true | ||
} | ||
|
||
resource "google_storage_bucket_object" "object" { | ||
name = "function-source.zip" | ||
bucket = google_storage_bucket.bucket.name | ||
source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code | ||
} | ||
|
||
resource "google_cloudfunctions2_function" "function" { | ||
name = "<%= ctx[:vars]['function_name'] %>" | ||
location = "us-central1" | ||
|
||
build_config { | ||
runtime = "nodejs16" | ||
entry_point = "SyntheticFunction" # Set the entry point | ||
source { | ||
storage_source { | ||
bucket = google_storage_bucket.bucket.name | ||
object = google_storage_bucket_object.object.name | ||
} | ||
} | ||
} | ||
|
||
service_config { | ||
max_instance_count = 1 | ||
available_memory = "256M" | ||
timeout_seconds = 60 | ||
} | ||
} | ||
|
||
resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] %>" { | ||
display_name = "<%= ctx[:vars]["display_name"] %>" | ||
timeout = "60s" | ||
|
||
synthetic_monitor { | ||
cloud_function_v2 { | ||
name = google_cloudfunctions2_function.function.id | ||
} | ||
} | ||
} |
Binary file added
BIN
+2.07 KB
mmv1/third_party/terraform/services/monitoring/test-fixtures/synthetic-fn-source.zip
Binary file not shown.