@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
109 lines • 5.04 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.ProtectionHealthCheckAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates an association between a Route53 Health Check and a Shield Advanced protected resource.
* This association uses the health of your applications to improve responsiveness and accuracy in attack detection and mitigation.
*
* Blog post: [AWS Shield Advanced now supports Health Based Detection](https://aws.amazon.com/about-aws/whats-new/2020/02/aws-shield-advanced-now-supports-health-based-detection/)
*
* ## Example Usage
*
* ### Create an association between a protected EIP and a Route53 Health Check
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getRegion({});
* const currentGetCallerIdentity = aws.getCallerIdentity({});
* const currentGetPartition = aws.getPartition({});
* const example = new aws.ec2.Eip("example", {
* domain: "vpc",
* tags: {
* Name: "example",
* },
* });
* const exampleProtection = new aws.shield.Protection("example", {
* name: "example-protection",
* resourceArn: pulumi.all([currentGetPartition, current, currentGetCallerIdentity, example.id]).apply(([currentGetPartition, current, currentGetCallerIdentity, id]) => `arn:${currentGetPartition.partition}:ec2:${current.region}:${currentGetCallerIdentity.accountId}:eip-allocation/${id}`),
* });
* const exampleHealthCheck = new aws.route53.HealthCheck("example", {
* ipAddress: example.publicIp,
* port: 80,
* type: "HTTP",
* resourcePath: "/ready",
* failureThreshold: 3,
* requestInterval: 30,
* tags: {
* Name: "tf-example-health-check",
* },
* });
* const exampleProtectionHealthCheckAssociation = new aws.shield.ProtectionHealthCheckAssociation("example", {
* healthCheckArn: exampleHealthCheck.arn,
* shieldProtectionId: exampleProtection.id,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Shield protection health check association resources using the `shield_protection_id` and `health_check_arn`. For example:
*
* ```sh
* $ pulumi import aws:shield/protectionHealthCheckAssociation:ProtectionHealthCheckAssociation example ff9592dc-22f3-4e88-afa1-7b29fde9669a+arn:aws:route53:::healthcheck/3742b175-edb9-46bc-9359-f53e3b794b1b
* ```
*/
class ProtectionHealthCheckAssociation extends pulumi.CustomResource {
/**
* Get an existing ProtectionHealthCheckAssociation 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 ProtectionHealthCheckAssociation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ProtectionHealthCheckAssociation. 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'] === ProtectionHealthCheckAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["healthCheckArn"] = state?.healthCheckArn;
resourceInputs["shieldProtectionId"] = state?.shieldProtectionId;
}
else {
const args = argsOrState;
if (args?.healthCheckArn === undefined && !opts.urn) {
throw new Error("Missing required property 'healthCheckArn'");
}
if (args?.shieldProtectionId === undefined && !opts.urn) {
throw new Error("Missing required property 'shieldProtectionId'");
}
resourceInputs["healthCheckArn"] = args?.healthCheckArn;
resourceInputs["shieldProtectionId"] = args?.shieldProtectionId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ProtectionHealthCheckAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.ProtectionHealthCheckAssociation = ProtectionHealthCheckAssociation;
/** @internal */
ProtectionHealthCheckAssociation.__pulumiType = 'aws:shield/protectionHealthCheckAssociation:ProtectionHealthCheckAssociation';
//# sourceMappingURL=protectionHealthCheckAssociation.js.map
;