Skip to content

Commit

Permalink
Health Check Logging (GoogleCloudPlatform#3346)
Browse files Browse the repository at this point in the history
* hc-logging

* update health checking example to be beta only

* RegionHealthCheck Logging test
  • Loading branch information
drebes authored and Nathan Klish committed May 18, 2020
1 parent f7fa802 commit 4c93a48
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
22 changes: 22 additions & 0 deletions products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4758,6 +4758,17 @@ objects:
- :USE_FIXED_PORT
- :USE_NAMED_PORT
- :USE_SERVING_PORT
- !ruby/object:Api::Type::NestedObject
name: 'logConfig'
description: |
Configure logging on this health check.
min_version: beta
properties:
- !ruby/object:Api::Type::Boolean
name: 'enable'
description: |
Indicates whether or not to export logs. This is false by default,
which means no health check logging will be done.
- !ruby/object:Api::Resource
name: 'InstanceTemplate'
kind: 'compute#instanceTemplate'
Expand Down Expand Up @@ -10516,6 +10527,17 @@ objects:
- :USE_FIXED_PORT
- :USE_NAMED_PORT
- :USE_SERVING_PORT
- !ruby/object:Api::Type::NestedObject
name: 'logConfig'
description: |
Configure logging on this health check.
min_version: beta
properties:
- !ruby/object:Api::Type::Boolean
name: 'enable'
description: |
Indicates whether or not to export logs. This is false by default,
which means no health check logging will be done.
- !ruby/object:Api::Resource
name: 'ResourcePolicy'
kind: 'compute#resourcePolicy'
Expand Down
12 changes: 12 additions & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,12 @@ overrides: !ruby/object:Overrides::ResourceOverrides
primary_resource_id: "http2-health-check"
vars:
health_check_name: "http2-health-check"
- !ruby/object:Provider::Terraform::Examples
name: "health_check_with_logging"
primary_resource_id: "health-check-with-logging"
min_version: beta
vars:
health_check_name: "tcp-health-check"
custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: templates/terraform/encoders/health_check_type.erb
constants: templates/terraform/constants/health_check.erb
Expand Down Expand Up @@ -1350,6 +1356,12 @@ overrides: !ruby/object:Overrides::ResourceOverrides
primary_resource_id: "http-region-health-check"
vars:
health_check_name: "http-region-health-check"
- !ruby/object:Provider::Terraform::Examples
name: "region_health_check_http_logs"
primary_resource_id: "http-region-health-check"
min_version: beta
vars:
health_check_name: "http-region-health-check"
- !ruby/object:Provider::Terraform::Examples
name: "region_health_check_http_full"
primary_resource_id: "http-region-health-check"
Expand Down
16 changes: 16 additions & 0 deletions templates/terraform/examples/health_check_with_logging.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "google_compute_health_check" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta

name = "<%= ctx[:vars]['health_check_name'] %>"

timeout_sec = 1
check_interval_sec = 1

tcp_health_check {
port = "22"
}

log_config {
enable = true
}
}
16 changes: 16 additions & 0 deletions templates/terraform/examples/region_health_check_http_logs.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "google_compute_region_health_check" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta

name = "<%= ctx[:vars]['health_check_name'] %>"

timeout_sec = 1
check_interval_sec = 1

http_health_check {
port = "80"
}

log_config {
enable = true
}
}

0 comments on commit 4c93a48

Please sign in to comment.