@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
485 lines • 16.7 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HealthCheck = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* 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.
*
* ~>**NOTE**: Legacy HTTP(S) health checks must be used for target pool-based network
* load balancers. See the [official guide](https://cloud.google.com/load-balancing/docs/health-check-concepts#selecting_hc)
* for choosing a type of health check.
*
* To get more information about HealthCheck, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/load-balancing/docs/health-checks)
*
* ## Example Usage
*
* ### Health Check Tcp
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const tcp_health_check = new gcp.compute.HealthCheck("tcp-health-check", {
* name: "tcp-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* tcpHealthCheck: {
* port: 80,
* },
* });
* ```
* ### Health Check Tcp Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const tcp_health_check = new gcp.compute.HealthCheck("tcp-health-check", {
* name: "tcp-health-check",
* description: "Health check via tcp",
* timeoutSec: 1,
* checkIntervalSec: 1,
* healthyThreshold: 4,
* unhealthyThreshold: 5,
* tcpHealthCheck: {
* portName: "health-check-port",
* portSpecification: "USE_NAMED_PORT",
* request: "ARE YOU HEALTHY?",
* proxyHeader: "NONE",
* response: "I AM HEALTHY",
* },
* });
* ```
* ### Health Check Ssl
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const ssl_health_check = new gcp.compute.HealthCheck("ssl-health-check", {
* name: "ssl-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* sslHealthCheck: {
* port: 443,
* },
* });
* ```
* ### Health Check Ssl Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const ssl_health_check = new gcp.compute.HealthCheck("ssl-health-check", {
* name: "ssl-health-check",
* description: "Health check via ssl",
* timeoutSec: 1,
* checkIntervalSec: 1,
* healthyThreshold: 4,
* unhealthyThreshold: 5,
* sslHealthCheck: {
* portName: "health-check-port",
* portSpecification: "USE_NAMED_PORT",
* request: "ARE YOU HEALTHY?",
* proxyHeader: "NONE",
* response: "I AM HEALTHY",
* },
* });
* ```
* ### Health Check Http
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const http_health_check = new gcp.compute.HealthCheck("http-health-check", {
* name: "http-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* httpHealthCheck: {
* port: 80,
* },
* });
* ```
* ### Health Check Http Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const http_health_check = new gcp.compute.HealthCheck("http-health-check", {
* name: "http-health-check",
* description: "Health check via http",
* timeoutSec: 1,
* checkIntervalSec: 1,
* healthyThreshold: 4,
* unhealthyThreshold: 5,
* httpHealthCheck: {
* portName: "health-check-port",
* portSpecification: "USE_NAMED_PORT",
* host: "1.2.3.4",
* requestPath: "/mypath",
* proxyHeader: "NONE",
* response: "I AM HEALTHY",
* },
* });
* ```
* ### Health Check Https
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const https_health_check = new gcp.compute.HealthCheck("https-health-check", {
* name: "https-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* httpsHealthCheck: {
* port: 443,
* },
* });
* ```
* ### Health Check Https Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const https_health_check = new gcp.compute.HealthCheck("https-health-check", {
* name: "https-health-check",
* description: "Health check via https",
* timeoutSec: 1,
* checkIntervalSec: 1,
* healthyThreshold: 4,
* unhealthyThreshold: 5,
* httpsHealthCheck: {
* portName: "health-check-port",
* portSpecification: "USE_NAMED_PORT",
* host: "1.2.3.4",
* requestPath: "/mypath",
* proxyHeader: "NONE",
* response: "I AM HEALTHY",
* },
* });
* ```
* ### Health Check Http2
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const http2_health_check = new gcp.compute.HealthCheck("http2-health-check", {
* name: "http2-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* http2HealthCheck: {
* port: 443,
* },
* });
* ```
* ### Health Check Http2 Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const http2_health_check = new gcp.compute.HealthCheck("http2-health-check", {
* name: "http2-health-check",
* description: "Health check via http2",
* timeoutSec: 1,
* checkIntervalSec: 1,
* healthyThreshold: 4,
* unhealthyThreshold: 5,
* http2HealthCheck: {
* portName: "health-check-port",
* portSpecification: "USE_NAMED_PORT",
* host: "1.2.3.4",
* requestPath: "/mypath",
* proxyHeader: "NONE",
* response: "I AM HEALTHY",
* },
* });
* ```
* ### Health Check Grpc
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const grpc_health_check = new gcp.compute.HealthCheck("grpc-health-check", {
* name: "grpc-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* grpcHealthCheck: {
* port: 443,
* },
* });
* ```
* ### Health Check Grpc Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const grpc_health_check = new gcp.compute.HealthCheck("grpc-health-check", {
* name: "grpc-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* grpcHealthCheck: {
* portName: "health-check-port",
* portSpecification: "USE_NAMED_PORT",
* grpcServiceName: "testservice",
* },
* });
* ```
* ### Health Check Grpc With Tls
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const grpc_with_tls_health_check = new gcp.compute.HealthCheck("grpc-with-tls-health-check", {
* name: "grpc-with-tls-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* grpcTlsHealthCheck: {
* port: 443,
* },
* });
* ```
* ### Health Check Grpc With Tls Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const grpc_with_tls_health_check = new gcp.compute.HealthCheck("grpc-with-tls-health-check", {
* name: "grpc-with-tls-health-check",
* description: "Health check via grpc with TLS",
* timeoutSec: 1,
* checkIntervalSec: 1,
* healthyThreshold: 4,
* unhealthyThreshold: 5,
* grpcTlsHealthCheck: {
* portSpecification: "USE_FIXED_PORT",
* port: 443,
* grpcServiceName: "testservice",
* },
* });
* ```
* ### Health Check With Logging
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const health_check_with_logging = new gcp.compute.HealthCheck("health-check-with-logging", {
* name: "tcp-health-check",
* timeoutSec: 1,
* checkIntervalSec: 1,
* tcpHealthCheck: {
* port: 22,
* },
* logConfig: {
* enable: true,
* },
* });
* ```
* ### Compute Health Check Http Source Regions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const http_health_check_with_source_regions = new gcp.compute.HealthCheck("http-health-check-with-source-regions", {
* name: "http-health-check",
* checkIntervalSec: 30,
* httpHealthCheck: {
* port: 80,
* portSpecification: "USE_FIXED_PORT",
* },
* sourceRegions: [
* "us-west1",
* "us-central1",
* "us-east5",
* ],
* });
* ```
* ### Compute Health Check Https Source Regions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const https_health_check_with_source_regions = new gcp.compute.HealthCheck("https-health-check-with-source-regions", {
* name: "https-health-check",
* checkIntervalSec: 30,
* httpsHealthCheck: {
* port: 80,
* portSpecification: "USE_FIXED_PORT",
* },
* sourceRegions: [
* "us-west1",
* "us-central1",
* "us-east5",
* ],
* });
* ```
* ### Compute Health Check Tcp Source Regions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const tcp_health_check_with_source_regions = new gcp.compute.HealthCheck("tcp-health-check-with-source-regions", {
* name: "tcp-health-check",
* checkIntervalSec: 30,
* tcpHealthCheck: {
* port: 80,
* portSpecification: "USE_FIXED_PORT",
* },
* sourceRegions: [
* "us-west1",
* "us-central1",
* "us-east5",
* ],
* });
* ```
*
* ## Import
*
* HealthCheck can be imported using any of these accepted formats:
*
* * `projects/{{project}}/global/healthChecks/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, HealthCheck can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/healthCheck:HealthCheck default projects/{{project}}/global/healthChecks/{{name}}
* $ pulumi import gcp:compute/healthCheck:HealthCheck default {{project}}/{{name}}
* $ pulumi import gcp:compute/healthCheck:HealthCheck default {{name}}
* ```
*/
class HealthCheck extends pulumi.CustomResource {
/**
* Get an existing HealthCheck resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new HealthCheck(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:compute/healthCheck:HealthCheck';
/**
* Returns true if the given object is an instance of HealthCheck. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === HealthCheck.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["checkIntervalSec"] = state?.checkIntervalSec;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["grpcHealthCheck"] = state?.grpcHealthCheck;
resourceInputs["grpcTlsHealthCheck"] = state?.grpcTlsHealthCheck;
resourceInputs["healthyThreshold"] = state?.healthyThreshold;
resourceInputs["http2HealthCheck"] = state?.http2HealthCheck;
resourceInputs["httpHealthCheck"] = state?.httpHealthCheck;
resourceInputs["httpsHealthCheck"] = state?.httpsHealthCheck;
resourceInputs["logConfig"] = state?.logConfig;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["sourceRegions"] = state?.sourceRegions;
resourceInputs["sslHealthCheck"] = state?.sslHealthCheck;
resourceInputs["tcpHealthCheck"] = state?.tcpHealthCheck;
resourceInputs["timeoutSec"] = state?.timeoutSec;
resourceInputs["type"] = state?.type;
resourceInputs["unhealthyThreshold"] = state?.unhealthyThreshold;
}
else {
const args = argsOrState;
resourceInputs["checkIntervalSec"] = args?.checkIntervalSec;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["grpcHealthCheck"] = args?.grpcHealthCheck;
resourceInputs["grpcTlsHealthCheck"] = args?.grpcTlsHealthCheck;
resourceInputs["healthyThreshold"] = args?.healthyThreshold;
resourceInputs["http2HealthCheck"] = args?.http2HealthCheck;
resourceInputs["httpHealthCheck"] = args?.httpHealthCheck;
resourceInputs["httpsHealthCheck"] = args?.httpsHealthCheck;
resourceInputs["logConfig"] = args?.logConfig;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project;
resourceInputs["sourceRegions"] = args?.sourceRegions;
resourceInputs["sslHealthCheck"] = args?.sslHealthCheck;
resourceInputs["tcpHealthCheck"] = args?.tcpHealthCheck;
resourceInputs["timeoutSec"] = args?.timeoutSec;
resourceInputs["unhealthyThreshold"] = args?.unhealthyThreshold;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(HealthCheck.__pulumiType, name, resourceInputs, opts);
}
}
exports.HealthCheck = HealthCheck;
//# sourceMappingURL=healthCheck.js.map