Autogenerate HealthCheck resource (#1941)

This commit is contained in:
The Magician 2018-08-27 16:35:47 -07:00 committed by Riley Karson
parent 83406c3c5f
commit f1f0bc97e2
3 changed files with 1036 additions and 493 deletions

View File

@ -26,6 +26,7 @@ var GeneratedComputeResourcesMap = map[string]*schema.Resource{
"google_compute_global_address": resourceComputeGlobalAddress(),
"google_compute_http_health_check": resourceComputeHttpHealthCheck(),
"google_compute_https_health_check": resourceComputeHttpsHealthCheck(),
"google_compute_health_check": resourceComputeHealthCheck(),
"google_compute_region_autoscaler": resourceComputeRegionAutoscaler(),
"google_compute_region_disk": resourceComputeRegionDisk(),
"google_compute_route": resourceComputeRoute(),

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,56 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
layout: "google"
page_title: "Google: google_compute_health_check"
sidebar_current: "docs-google-compute-health-check"
description: |-
Manages a Health Check within GCE.
Health Checks determine whether instances are responsive and able to do work.
---
# google\_compute\_health\_check
Manages a health check within GCE. This is used to monitor instances
behind load balancers. Timeouts or HTTP errors cause the instance to be
removed from the pool. For more information, see [the official
documentation](https://cloud.google.com/compute/docs/load-balancing/health-checks)
and
[API](https://cloud.google.com/compute/docs/reference/latest/healthChecks).
Health Checks determine whether instances are responsive and able to do work.
They are an important part of a comprehensive load balancing configuration,
as they enable monitoring instances behind load balancers.
Health Checks poll instances at a specified interval. Instances that
do not respond successfully to some number of probes in a row are marked
as unhealthy. No new connections are sent to unhealthy instances,
though existing connections will continue. The health check will
continue to poll unhealthy instances. If an instance later responds
successfully to some number of consecutive probes, it is marked
healthy again and can receive new connections.
To get more information about HealthCheck, see:
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/latest/healthChecks)
* How-to Guides
* [Official Documentation](https://cloud.google.com/load-balancing/docs/health-checks)
## Example Usage
```tf
resource "google_compute_health_check" "default" {
name = "internal-service-health-check"
```hcl
resource "google_compute_health_check" "internal-health-check" {
name = "internal-service-health-check"
timeout_sec = 1
check_interval_sec = 1
timeout_sec = 1
check_interval_sec = 1
tcp_health_check {
port = "80"
}
tcp_health_check {
port = "80"
}
}
```
@ -34,100 +58,190 @@ resource "google_compute_health_check" "default" {
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
* `name` -
(Required)
Name of the resource. Provided by the client when the resource is
created. The name must be 1-63 characters long, and comply with
RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means
the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the
last character, which cannot be a dash.
- - -
* `check_interval_sec` - (Optional) The number of seconds between each poll of
the instance instance (default 5).
* `description` - (Optional) Textual description field.
* `check_interval_sec` -
(Optional)
How often (in seconds) to send a health check. The default value is 5
seconds.
* `healthy_threshold` - (Optional) Consecutive successes required (default 2).
* `description` -
(Optional)
An optional description of this resource. Provide this property when
you create the resource.
* `http_health_check` - (Optional) An HTTP Health Check. Only one kind of Health Check can be added.
Structure is documented below.
* `healthy_threshold` -
(Optional)
A so-far unhealthy instance will be marked healthy after this many
consecutive successes. The default value is 2.
* `https_health_check` - (Optional) An HTTPS Health Check. Only one kind of Health Check can be added.
Structure is documented below.
* `timeout_sec` -
(Optional)
How long (in seconds) to wait before claiming failure.
The default value is 5 seconds. It is invalid for timeoutSec to have
greater value than checkIntervalSec.
* `ssl_health_check` - (Optional) An SSL Health Check. Only one kind of Health Check can be added.
Structure is documented below.
* `unhealthy_threshold` -
(Optional)
A so-far healthy instance will be marked unhealthy after this many
consecutive failures. The default value is 2.
* `tcp_health_check` - (Optional) A TCP Health Check. Only one kind of Health Check can be added.
Structure is documented below.
* `http_health_check` -
(Optional)
A nested object resource Structure is documented below.
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `https_health_check` -
(Optional)
A nested object resource Structure is documented below.
* `timeout_sec` - (Optional) The number of seconds to wait before declaring
failure (default 5).
* `tcp_health_check` -
(Optional)
A nested object resource Structure is documented below.
* `unhealthy_threshold` - (Optional) Consecutive failures required (default 2).
* `ssl_health_check` -
(Optional)
A nested object resource Structure is documented below.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The `http_health_check` block supports:
* `host` - (Optional) HTTP host header field (default instance's public ip).
* `host` -
(Optional)
The value of the host header in the HTTP health check request.
If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
* `port` - (Optional) TCP port to connect to (default 80).
* `request_path` -
(Optional)
The request path of the HTTP health check request.
The default value is /.
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request_path` - (Optional) URL path to query (default /).
* `port` -
(Optional)
The TCP port number for the HTTP health check request.
The default value is 80.
* `proxy_header` -
(Optional)
Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
The `https_health_check` block supports:
* `host` - (Optional) HTTPS host header field (default instance's public ip).
* `host` -
(Optional)
The value of the host header in the HTTPS health check request.
If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
* `port` - (Optional) TCP port to connect to (default 443).
* `request_path` -
(Optional)
The request path of the HTTPS health check request.
The default value is /.
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request_path` - (Optional) URL path to query (default /).
The `ssl_health_check` block supports:
* `port` - (Optional) TCP port to connect to (default 443).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request` - (Optional) Application data to send once the SSL connection has
been established (default "").
* `response` - (Optional) The response that indicates health (default "")
* `port` -
(Optional)
The TCP port number for the HTTPS health check request.
The default value is 443.
* `proxy_header` -
(Optional)
Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
The `tcp_health_check` block supports:
* `port` - (Optional) TCP port to connect to (default 80).
* `request` -
(Optional)
The application data to send once the TCP connection has been
established (default value is empty). If both request and response are
empty, the connection establishment alone will indicate health. The request
data can only be ASCII.
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `response` -
(Optional)
The bytes to match against the beginning of the response data. If left empty
(the default value), any response will indicate health. The response data
can only be ASCII.
* `request` - (Optional) Application data to send once the TCP connection has
been established (default "").
* `port` -
(Optional)
The TCP port number for the TCP health check request.
The default value is 443.
* `response` - (Optional) The response that indicates health (default "")
* `proxy_header` -
(Optional)
Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
The `ssl_health_check` block supports:
* `request` -
(Optional)
The application data to send once the SSL connection has been
established (default value is empty). If both request and response are
empty, the connection establishment alone will indicate health. The request
data can only be ASCII.
* `response` -
(Optional)
The bytes to match against the beginning of the response data. If left empty
(the default value), any response will indicate health. The response data
can only be ASCII.
* `port` -
(Optional)
The TCP port number for the SSL health check request.
The default value is 443.
* `proxy_header` -
(Optional)
Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
In addition to the arguments listed above, the following computed attributes are exported:
* `creation_timestamp` -
Creation timestamp in RFC3339 text format.
* `type` -
The type of the health check. One of HTTP, HTTPS, TCP, or SSL.
* `self_link` - The URI of the created resource.
## Timeouts
This resource provides the following
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
- `create` - Default is 4 minutes.
- `update` - Default is 4 minutes.
- `delete` - Default is 4 minutes.
## Import
Health checks can be imported using the `name`, e.g.
HealthCheck can be imported using any of these accepted formats:
```
$ terraform import google_compute_health_check.default internal-service-health-check
$ terraform import google_compute_health_check.default projects/{{project}}/global/healthChecks/{{name}}
$ terraform import google_compute_health_check.default {{project}}/{{name}}
$ terraform import google_compute_health_check.default {{name}}
```