diff --git a/products/compute/api.yaml b/products/compute/api.yaml index 3f5f1b87f975..22c7e4a7faae 100644 --- a/products/compute/api.yaml +++ b/products/compute/api.yaml @@ -4759,6 +4759,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' @@ -10507,6 +10518,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' diff --git a/products/compute/terraform.yaml b/products/compute/terraform.yaml index 90a0407b6c52..6fc957a0d336 100644 --- a/products/compute/terraform.yaml +++ b/products/compute/terraform.yaml @@ -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 @@ -1348,6 +1354,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" diff --git a/templates/terraform/examples/health_check_with_logging.tf.erb b/templates/terraform/examples/health_check_with_logging.tf.erb new file mode 100644 index 000000000000..2830336a3bc3 --- /dev/null +++ b/templates/terraform/examples/health_check_with_logging.tf.erb @@ -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 + } +} diff --git a/templates/terraform/examples/region_health_check_http_logs.tf.erb b/templates/terraform/examples/region_health_check_http_logs.tf.erb new file mode 100644 index 000000000000..a50558f4ad61 --- /dev/null +++ b/templates/terraform/examples/region_health_check_http_logs.tf.erb @@ -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 + } +}