UNPKG

@pulumi/aws

Version:

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

148 lines 6.13 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.ReplicationSubnetGroup = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a DMS (Data Migration Service) replication subnet group resource. DMS replication subnet groups can be created, updated, deleted, and imported. * * > **Note:** AWS requires a special IAM role called `dms-vpc-role` when using this resource. See the example below to create it as part of your configuration. * * ## Example Usage * * ### Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Create a new replication subnet group * const example = new aws.dms.ReplicationSubnetGroup("example", { * replicationSubnetGroupDescription: "Example replication subnet group", * replicationSubnetGroupId: "example-dms-replication-subnet-group-tf", * subnetIds: [ * "subnet-12345678", * "subnet-12345679", * ], * tags: { * Name: "example", * }, * }); * ``` * * ### Creating special IAM role * * If your account does not already include the `dms-vpc-role` IAM role, you will need to create it to allow DMS to manage subnets in the VPC. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const dms_vpc_role = new aws.iam.Role("dms-vpc-role", { * name: "dms-vpc-role", * description: "Allows DMS to manage VPC", * assumeRolePolicy: JSON.stringify({ * Version: "2012-10-17", * Statement: [{ * Effect: "Allow", * Principal: { * Service: "dms.amazonaws.com", * }, * Action: "sts:AssumeRole", * }], * }), * }); * const example = new aws.iam.RolePolicyAttachment("example", { * role: dms_vpc_role.name, * policyArn: "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole", * }); * const exampleReplicationSubnetGroup = new aws.dms.ReplicationSubnetGroup("example", { * replicationSubnetGroupDescription: "Example", * replicationSubnetGroupId: "example-id", * subnetIds: [ * "subnet-12345678", * "subnet-12345679", * ], * tags: { * Name: "example-id", * }, * }, { * dependsOn: [example], * }); * ``` * * ## Import * * Using `pulumi import`, import replication subnet groups using the `replication_subnet_group_id`. For example: * * ```sh * $ pulumi import aws:dms/replicationSubnetGroup:ReplicationSubnetGroup test test-dms-replication-subnet-group-tf * ``` */ class ReplicationSubnetGroup extends pulumi.CustomResource { /** * Get an existing ReplicationSubnetGroup 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 ReplicationSubnetGroup(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ReplicationSubnetGroup. 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'] === ReplicationSubnetGroup.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["region"] = state?.region; resourceInputs["replicationSubnetGroupArn"] = state?.replicationSubnetGroupArn; resourceInputs["replicationSubnetGroupDescription"] = state?.replicationSubnetGroupDescription; resourceInputs["replicationSubnetGroupId"] = state?.replicationSubnetGroupId; resourceInputs["subnetIds"] = state?.subnetIds; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["vpcId"] = state?.vpcId; } else { const args = argsOrState; if (args?.replicationSubnetGroupDescription === undefined && !opts.urn) { throw new Error("Missing required property 'replicationSubnetGroupDescription'"); } if (args?.replicationSubnetGroupId === undefined && !opts.urn) { throw new Error("Missing required property 'replicationSubnetGroupId'"); } if (args?.subnetIds === undefined && !opts.urn) { throw new Error("Missing required property 'subnetIds'"); } resourceInputs["region"] = args?.region; resourceInputs["replicationSubnetGroupDescription"] = args?.replicationSubnetGroupDescription; resourceInputs["replicationSubnetGroupId"] = args?.replicationSubnetGroupId; resourceInputs["subnetIds"] = args?.subnetIds; resourceInputs["tags"] = args?.tags; resourceInputs["replicationSubnetGroupArn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["vpcId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ReplicationSubnetGroup.__pulumiType, name, resourceInputs, opts); } } exports.ReplicationSubnetGroup = ReplicationSubnetGroup; /** @internal */ ReplicationSubnetGroup.__pulumiType = 'aws:dms/replicationSubnetGroup:ReplicationSubnetGroup'; //# sourceMappingURL=replicationSubnetGroup.js.map