@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
136 lines • 4.87 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.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Service Discovery Instance resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.Vpc("example", {
* cidrBlock: "10.0.0.0/16",
* enableDnsSupport: true,
* enableDnsHostnames: true,
* });
* const examplePrivateDnsNamespace = new aws.servicediscovery.PrivateDnsNamespace("example", {
* name: "example.domain.local",
* description: "example",
* vpc: example.id,
* });
* const exampleService = new aws.servicediscovery.Service("example", {
* name: "example",
* dnsConfig: {
* namespaceId: examplePrivateDnsNamespace.id,
* dnsRecords: [{
* ttl: 10,
* type: "A",
* }],
* routingPolicy: "MULTIVALUE",
* },
* healthCheckCustomConfig: {
* failureThreshold: 1,
* },
* });
* const exampleInstance = new aws.servicediscovery.Instance("example", {
* instanceId: "example-instance-id",
* serviceId: exampleService.id,
* attributes: {
* AWS_INSTANCE_IPV4: "172.18.0.1",
* custom_attribute: "custom",
* },
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.servicediscovery.HttpNamespace("example", {
* name: "example.domain.test",
* description: "example",
* });
* const exampleService = new aws.servicediscovery.Service("example", {
* name: "example",
* namespaceId: example.id,
* });
* const exampleInstance = new aws.servicediscovery.Instance("example", {
* instanceId: "example-instance-id",
* serviceId: exampleService.id,
* attributes: {
* AWS_EC2_INSTANCE_ID: "i-0abdg374kd892cj6dl",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Service Discovery Instance using the service ID and instance ID. For example:
*
* ```sh
* $ pulumi import aws:servicediscovery/instance:Instance example 0123456789/i-0123
* ```
*/
class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance 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 Instance(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["attributes"] = state?.attributes;
resourceInputs["instanceId"] = state?.instanceId;
resourceInputs["region"] = state?.region;
resourceInputs["serviceId"] = state?.serviceId;
}
else {
const args = argsOrState;
if (args?.attributes === undefined && !opts.urn) {
throw new Error("Missing required property 'attributes'");
}
if (args?.instanceId === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceId'");
}
if (args?.serviceId === undefined && !opts.urn) {
throw new Error("Missing required property 'serviceId'");
}
resourceInputs["attributes"] = args?.attributes;
resourceInputs["instanceId"] = args?.instanceId;
resourceInputs["region"] = args?.region;
resourceInputs["serviceId"] = args?.serviceId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'aws:servicediscovery/instance:Instance';
//# sourceMappingURL=instance.js.map
;