UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

168 lines 6.63 kB
"use strict"; // *** 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.ServiceRegion = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a replicated Region and directory for Multi-Region replication. * Multi-Region replication is only supported for the Enterprise Edition of AWS Managed Microsoft AD. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as std from "@pulumi/std"; * * const example = aws.getRegion({}); * const available = aws.getAvailabilityZones({ * state: "available", * filters: [{ * name: "opt-in-status", * values: ["opt-in-not-required"], * }], * }); * const exampleVpc = new aws.ec2.Vpc("example", { * cidrBlock: "10.0.0.0/16", * tags: { * Name: "Primary", * }, * }); * const exampleSubnet: aws.ec2.Subnet[] = []; * for (const range = {value: 0}; range.value < 2; range.value++) { * exampleSubnet.push(new aws.ec2.Subnet(`example-${range.value}`, { * vpcId: exampleVpc.id, * availabilityZone: available.then(available => available.names[range.value]), * cidrBlock: exampleVpc.cidrBlock.apply(cidrBlock => std.cidrsubnetOutput({ * input: cidrBlock, * newbits: 8, * netnum: range.value, * })).apply(invoke => invoke.result), * tags: { * Name: "Primary", * }, * })); * } * const exampleDirectory = new aws.directoryservice.Directory("example", { * name: "example.com", * password: "SuperSecretPassw0rd", * type: "MicrosoftAD", * vpcSettings: { * vpcId: exampleVpc.id, * subnetIds: exampleSubnet.map(__item => __item.id), * }, * }); * const available_secondary = aws.getAvailabilityZones({ * state: "available", * filters: [{ * name: "opt-in-status", * values: ["opt-in-not-required"], * }], * }); * const example_secondary = new aws.ec2.Vpc("example-secondary", { * cidrBlock: "10.1.0.0/16", * tags: { * Name: "Secondary", * }, * }); * const example_secondarySubnet: aws.ec2.Subnet[] = []; * for (const range = {value: 0}; range.value < 2; range.value++) { * example_secondarySubnet.push(new aws.ec2.Subnet(`example-secondary-${range.value}`, { * vpcId: example_secondary.id, * availabilityZone: available_secondary.then(available_secondary => available_secondary.names[range.value]), * cidrBlock: example_secondary.cidrBlock.apply(cidrBlock => std.cidrsubnetOutput({ * input: cidrBlock, * newbits: 8, * netnum: range.value, * })).apply(invoke => invoke.result), * tags: { * Name: "Secondary", * }, * })); * } * const exampleServiceRegion = new aws.directoryservice.ServiceRegion("example", { * directoryId: exampleDirectory.id, * regionName: example.then(example => example.name), * vpcSettings: { * vpcId: example_secondary.id, * subnetIds: example_secondarySubnet.map(__item => __item.id), * }, * tags: { * Name: "Secondary", * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Replicated Regions using directory ID,Region name. For example: * * ```sh * $ pulumi import aws:directoryservice/serviceRegion:ServiceRegion example d-9267651497,us-east-2 * ``` */ class ServiceRegion extends pulumi.CustomResource { /** * Get an existing ServiceRegion 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 ServiceRegion(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ServiceRegion. 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'] === ServiceRegion.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["desiredNumberOfDomainControllers"] = state?.desiredNumberOfDomainControllers; resourceInputs["directoryId"] = state?.directoryId; resourceInputs["region"] = state?.region; resourceInputs["regionName"] = state?.regionName; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["vpcSettings"] = state?.vpcSettings; } else { const args = argsOrState; if (args?.directoryId === undefined && !opts.urn) { throw new Error("Missing required property 'directoryId'"); } if (args?.regionName === undefined && !opts.urn) { throw new Error("Missing required property 'regionName'"); } if (args?.vpcSettings === undefined && !opts.urn) { throw new Error("Missing required property 'vpcSettings'"); } resourceInputs["desiredNumberOfDomainControllers"] = args?.desiredNumberOfDomainControllers; resourceInputs["directoryId"] = args?.directoryId; resourceInputs["region"] = args?.region; resourceInputs["regionName"] = args?.regionName; resourceInputs["tags"] = args?.tags; resourceInputs["vpcSettings"] = args?.vpcSettings; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ServiceRegion.__pulumiType, name, resourceInputs, opts); } } exports.ServiceRegion = ServiceRegion; /** @internal */ ServiceRegion.__pulumiType = 'aws:directoryservice/serviceRegion:ServiceRegion'; //# sourceMappingURL=serviceRegion.js.map