@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
219 lines • 8.62 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.HealthCheck = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Route53 health check.
*
* ## Example Usage
*
* ### Connectivity and HTTP Status Code Check
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.route53.HealthCheck("example", {
* fqdn: "example.com",
* port: 80,
* type: "HTTP",
* resourcePath: "/",
* failureThreshold: 5,
* requestInterval: 30,
* tags: {
* Name: "tf-test-health-check",
* },
* });
* ```
*
* ### Connectivity and String Matching Check
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.route53.HealthCheck("example", {
* failureThreshold: 5,
* fqdn: "example.com",
* port: 443,
* requestInterval: 30,
* resourcePath: "/",
* searchString: "example",
* type: "HTTPS_STR_MATCH",
* });
* ```
*
* ### Aggregate Check
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const parent = new aws.route53.HealthCheck("parent", {
* type: "CALCULATED",
* childHealthThreshold: 1,
* childHealthchecks: [child.id],
* tags: {
* Name: "tf-test-calculated-health-check",
* },
* });
* ```
*
* ### CloudWatch Alarm Check
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const foobar = new aws.cloudwatch.MetricAlarm("foobar", {
* name: "test-foobar5",
* comparisonOperator: "GreaterThanOrEqualToThreshold",
* evaluationPeriods: 2,
* metricName: "CPUUtilization",
* namespace: "AWS/EC2",
* period: 120,
* statistic: "Average",
* threshold: 80,
* alarmDescription: "This metric monitors ec2 cpu utilization",
* });
* const foo = new aws.route53.HealthCheck("foo", {
* type: "CLOUDWATCH_METRIC",
* cloudwatchAlarmName: foobar.name,
* cloudwatchAlarmRegion: "us-west-2",
* insufficientDataHealthStatus: "Healthy",
* });
* ```
*
* ### CloudWatch Alarm Check With Triggers
*
* The `triggers` argument allows the Route53 health check to be synchronized when a change to the upstream CloudWatch alarm is made.
* In the configuration below, the health check will be synchronized any time the `threshold` of the alarm is changed.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudwatch.MetricAlarm("example", {
* name: "example",
* comparisonOperator: "GreaterThanOrEqualToThreshold",
* evaluationPeriods: 2,
* metricName: "CPUUtilization",
* namespace: "AWS/EC2",
* period: 120,
* statistic: "Average",
* threshold: 80,
* alarmDescription: "This metric monitors ec2 cpu utilization",
* });
* const exampleHealthCheck = new aws.route53.HealthCheck("example", {
* type: "CLOUDWATCH_METRIC",
* cloudwatchAlarmName: example.name,
* cloudwatchAlarmRegion: "us-west-2",
* insufficientDataHealthStatus: "Healthy",
* triggers: {
* threshold: example.threshold,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Route53 Health Checks using the health check `id`. For example:
*
* ```sh
* $ pulumi import aws:route53/healthCheck:HealthCheck http_check abcdef11-2222-3333-4444-555555fedcba
* ```
*/
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 });
}
/**
* 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["arn"] = state?.arn;
resourceInputs["childHealthThreshold"] = state?.childHealthThreshold;
resourceInputs["childHealthchecks"] = state?.childHealthchecks;
resourceInputs["cloudwatchAlarmName"] = state?.cloudwatchAlarmName;
resourceInputs["cloudwatchAlarmRegion"] = state?.cloudwatchAlarmRegion;
resourceInputs["disabled"] = state?.disabled;
resourceInputs["enableSni"] = state?.enableSni;
resourceInputs["failureThreshold"] = state?.failureThreshold;
resourceInputs["fqdn"] = state?.fqdn;
resourceInputs["insufficientDataHealthStatus"] = state?.insufficientDataHealthStatus;
resourceInputs["invertHealthcheck"] = state?.invertHealthcheck;
resourceInputs["ipAddress"] = state?.ipAddress;
resourceInputs["measureLatency"] = state?.measureLatency;
resourceInputs["port"] = state?.port;
resourceInputs["referenceName"] = state?.referenceName;
resourceInputs["regions"] = state?.regions;
resourceInputs["requestInterval"] = state?.requestInterval;
resourceInputs["resourcePath"] = state?.resourcePath;
resourceInputs["routingControlArn"] = state?.routingControlArn;
resourceInputs["searchString"] = state?.searchString;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["triggers"] = state?.triggers;
resourceInputs["type"] = state?.type;
}
else {
const args = argsOrState;
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["childHealthThreshold"] = args?.childHealthThreshold;
resourceInputs["childHealthchecks"] = args?.childHealthchecks;
resourceInputs["cloudwatchAlarmName"] = args?.cloudwatchAlarmName;
resourceInputs["cloudwatchAlarmRegion"] = args?.cloudwatchAlarmRegion;
resourceInputs["disabled"] = args?.disabled;
resourceInputs["enableSni"] = args?.enableSni;
resourceInputs["failureThreshold"] = args?.failureThreshold;
resourceInputs["fqdn"] = args?.fqdn;
resourceInputs["insufficientDataHealthStatus"] = args?.insufficientDataHealthStatus;
resourceInputs["invertHealthcheck"] = args?.invertHealthcheck;
resourceInputs["ipAddress"] = args?.ipAddress;
resourceInputs["measureLatency"] = args?.measureLatency;
resourceInputs["port"] = args?.port;
resourceInputs["referenceName"] = args?.referenceName;
resourceInputs["regions"] = args?.regions;
resourceInputs["requestInterval"] = args?.requestInterval;
resourceInputs["resourcePath"] = args?.resourcePath;
resourceInputs["routingControlArn"] = args?.routingControlArn;
resourceInputs["searchString"] = args?.searchString;
resourceInputs["tags"] = args?.tags;
resourceInputs["triggers"] = args?.triggers;
resourceInputs["type"] = args?.type;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(HealthCheck.__pulumiType, name, resourceInputs, opts);
}
}
exports.HealthCheck = HealthCheck;
/** @internal */
HealthCheck.__pulumiType = 'aws:route53/healthCheck:HealthCheck';
//# sourceMappingURL=healthCheck.js.map