import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Provides an independent configuration resource for S3 bucket [replication configuration](http://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html). * * > **NOTE:** S3 Buckets only support a single replication configuration. Declaring multiple `aws.s3.BucketReplicationConfig` resources to the same S3 Bucket will cause a perpetual difference in configuration. * * > This resource cannot be used with S3 directory buckets. * * ## Example Usage * * ### Using replication configuration * * ### Terraform AWS Provider v5 (and below) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * principals: [{ * type: "Service", * identifiers: ["s3.amazonaws.com"], * }], * effect: "Allow", * actions: ["sts:AssumeRole"], * }], * }); * const replicationRole = new aws.iam.Role("replication", { * name: "tf-iam-role-replication-12345", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const destination = new aws.s3.Bucket("destination", {bucket: "tf-test-bucket-destination-12345"}); * const source = new aws.s3.Bucket("source", {bucket: "tf-test-bucket-source-12345"}); * const replication = aws.iam.getPolicyDocumentOutput({ * statements: [ * { * effect: "Allow", * actions: [ * "s3:GetReplicationConfiguration", * "s3:ListBucket", * ], * resources: [source.arn], * }, * { * effect: "Allow", * actions: [ * "s3:GetObjectVersionForReplication", * "s3:GetObjectVersionAcl", * "s3:GetObjectVersionTagging", * ], * resources: [pulumi.interpolate`${source.arn}/*`], * }, * { * effect: "Allow", * actions: [ * "s3:ReplicateObject", * "s3:ReplicateDelete", * "s3:ReplicateTags", * ], * resources: [pulumi.interpolate`${destination.arn}/*`], * }, * ], * }); * const replicationPolicy = new aws.iam.Policy("replication", { * name: "tf-iam-role-policy-replication-12345", * policy: replication.json, * }); * const replicationRolePolicyAttachment = new aws.iam.RolePolicyAttachment("replication", { * role: replicationRole.name, * policyArn: replicationPolicy.arn, * }); * const destinationBucketVersioning = new aws.s3.BucketVersioning("destination", { * versioningConfiguration: { * status: "Enabled", * }, * bucket: destination.id, * }); * const sourceBucketAcl = new aws.s3.BucketAcl("source_bucket_acl", { * bucket: source.id, * acl: "private", * }); * const sourceBucketVersioning = new aws.s3.BucketVersioning("source", { * versioningConfiguration: { * status: "Enabled", * }, * bucket: source.id, * }); * const replicationBucketReplicationConfig = new aws.s3.BucketReplicationConfig("replication", { * rules: [{ * filter: { * prefix: "example", * }, * destination: { * bucket: destination.arn, * storageClass: "STANDARD", * }, * id: "examplerule", * status: "Enabled", * }], * role: replicationRole.arn, * bucket: source.id, * }, { * dependsOn: [sourceBucketVersioning], * }); * ``` * * ### Terraform AWS Provider v6 (and above) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * principals: [{ * type: "Service", * identifiers: ["s3.amazonaws.com"], * }], * effect: "Allow", * actions: ["sts:AssumeRole"], * }], * }); * const replicationRole = new aws.iam.Role("replication", { * name: "tf-iam-role-replication-12345", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const destination = new aws.s3.Bucket("destination", {bucket: "tf-test-bucket-destination-12345"}); * const source = new aws.s3.Bucket("source", { * region: "eu-central-1", * bucket: "tf-test-bucket-source-12345", * }); * const replication = aws.iam.getPolicyDocumentOutput({ * statements: [ * { * effect: "Allow", * actions: [ * "s3:GetReplicationConfiguration", * "s3:ListBucket", * ], * resources: [source.arn], * }, * { * effect: "Allow", * actions: [ * "s3:GetObjectVersionForReplication", * "s3:GetObjectVersionAcl", * "s3:GetObjectVersionTagging", * ], * resources: [pulumi.interpolate`${source.arn}/*`], * }, * { * effect: "Allow", * actions: [ * "s3:ReplicateObject", * "s3:ReplicateDelete", * "s3:ReplicateTags", * ], * resources: [pulumi.interpolate`${destination.arn}/*`], * }, * ], * }); * const replicationPolicy = new aws.iam.Policy("replication", { * name: "tf-iam-role-policy-replication-12345", * policy: replication.json, * }); * const replicationRolePolicyAttachment = new aws.iam.RolePolicyAttachment("replication", { * role: replicationRole.name, * policyArn: replicationPolicy.arn, * }); * const destinationBucketVersioning = new aws.s3.BucketVersioning("destination", { * versioningConfiguration: { * status: "Enabled", * }, * bucket: destination.id, * }); * const sourceBucketAcl = new aws.s3.BucketAcl("source_bucket_acl", { * region: "eu-central-1", * bucket: source.id, * acl: "private", * }); * const sourceBucketVersioning = new aws.s3.BucketVersioning("source", { * versioningConfiguration: { * status: "Enabled", * }, * region: "eu-central-1", * bucket: source.id, * }); * const replicationBucketReplicationConfig = new aws.s3.BucketReplicationConfig("replication", { * rules: [{ * filter: { * prefix: "example", * }, * destination: { * bucket: destination.arn, * storageClass: "STANDARD", * }, * id: "examplerule", * status: "Enabled", * }], * region: "eu-central-1", * role: replicationRole.arn, * bucket: source.id, * }, { * dependsOn: [sourceBucketVersioning], * }); * ``` * * ### Bi-Directional Replication * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // ... other configuration ... * const east = new aws.s3.Bucket("east", {bucket: "tf-test-bucket-east-12345"}); * const eastBucketVersioning = new aws.s3.BucketVersioning("east", { * versioningConfiguration: { * status: "Enabled", * }, * bucket: east.id, * }); * const west = new aws.s3.Bucket("west", {bucket: "tf-test-bucket-west-12345"}); * const westBucketVersioning = new aws.s3.BucketVersioning("west", { * versioningConfiguration: { * status: "Enabled", * }, * bucket: west.id, * }); * const eastToWest = new aws.s3.BucketReplicationConfig("east_to_west", { * rules: [{ * filter: { * prefix: "foo", * }, * destination: { * bucket: west.arn, * storageClass: "STANDARD", * }, * id: "foobar", * status: "Enabled", * }], * role: eastReplication.arn, * bucket: east.id, * }, { * dependsOn: [eastBucketVersioning], * }); * const westToEast = new aws.s3.BucketReplicationConfig("west_to_east", { * rules: [{ * filter: { * prefix: "foo", * }, * destination: { * bucket: east.arn, * storageClass: "STANDARD", * }, * id: "foobar", * status: "Enabled", * }], * role: westReplication.arn, * bucket: west.id, * }, { * dependsOn: [westBucketVersioning], * }); * ``` * * ## Import * * Using `pulumi import`, import S3 bucket replication configuration using the `bucket`. For example: * * ```sh * $ pulumi import aws:s3/bucketReplicationConfig:BucketReplicationConfig replication bucket-name * ``` */ export declare class BucketReplicationConfig extends pulumi.CustomResource { /** * Get an existing BucketReplicationConfig 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: string, id: pulumi.Input, state?: BucketReplicationConfigState, opts?: pulumi.CustomResourceOptions): BucketReplicationConfig; /** * Returns true if the given object is an instance of BucketReplicationConfig. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is BucketReplicationConfig; /** * Name of the source S3 bucket you want Amazon S3 to monitor. */ readonly bucket: pulumi.Output; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output; /** * ARN of the IAM role for Amazon S3 to assume when replicating the objects. */ readonly role: pulumi.Output; /** * List of configuration blocks describing the rules managing the replication. See below. */ readonly rules: pulumi.Output; /** * Token to allow replication to be enabled on an Object Lock-enabled bucket. You must contact AWS support for the bucket's "Object Lock token". For more details, see [Using S3 Object Lock with replication](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-managing.html#object-lock-managing-replication). */ readonly token: pulumi.Output; /** * Create a BucketReplicationConfig resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: BucketReplicationConfigArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering BucketReplicationConfig resources. */ export interface BucketReplicationConfigState { /** * Name of the source S3 bucket you want Amazon S3 to monitor. */ bucket?: pulumi.Input; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input; /** * ARN of the IAM role for Amazon S3 to assume when replicating the objects. */ role?: pulumi.Input; /** * List of configuration blocks describing the rules managing the replication. See below. */ rules?: pulumi.Input[] | undefined>; /** * Token to allow replication to be enabled on an Object Lock-enabled bucket. You must contact AWS support for the bucket's "Object Lock token". For more details, see [Using S3 Object Lock with replication](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-managing.html#object-lock-managing-replication). */ token?: pulumi.Input; } /** * The set of arguments for constructing a BucketReplicationConfig resource. */ export interface BucketReplicationConfigArgs { /** * Name of the source S3 bucket you want Amazon S3 to monitor. */ bucket: pulumi.Input; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input; /** * ARN of the IAM role for Amazon S3 to assume when replicating the objects. */ role: pulumi.Input; /** * List of configuration blocks describing the rules managing the replication. See below. */ rules: pulumi.Input[]>; /** * Token to allow replication to be enabled on an Object Lock-enabled bucket. You must contact AWS support for the bucket's "Object Lock token". For more details, see [Using S3 Object Lock with replication](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-managing.html#object-lock-managing-replication). */ token?: pulumi.Input; } //# sourceMappingURL=bucketReplicationConfig.d.ts.map