Resource
dcloud_bucket_replication
Cross-zone replication of a bucket (S3 CRR): its objects are copied, by the platform, to other buckets of the organization. Both buckets need versioning enabled. Destroying it stops replication; replicas already made are kept.
Example Usage
resource "dcloud_bucket" "uploads" {
name = "acme-uploads"
zone = "de1a" # Falkenstein
}
resource "dcloud_bucket" "uploads_copy" {
name = "acme-uploads-nbg"
zone = "de1b" # Nuremberg
}
# Both buckets need versioning before replication can be configured
# (`dcloud s3 bucket-versioning set acme-uploads --enabled`).
resource "dcloud_bucket_replication" "uploads" {
bucket = dcloud_bucket.uploads.id
rules = jsonencode([
{
destination = dcloud_bucket.uploads_copy.id
prefix = ""
deleteMarkerReplication = true
existingObjects = true
},
])
}Schema
Required
bucket(String) The id of the parent resource ({name}in the path). Changing it replaces the resource.rules(String) The rules,[{ destination, prefix, deleteMarkerReplication, existingObjects }]; usejsonencode.
Optional
role(String) An IAM role ARN as AWS tools send it; kept for S3 GetBucketReplication, otherwise ignored. Up to 2048 characters.
Read-Only
id(String) The resource's id.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import dcloud_bucket_replication.uploads <bucket-name>Generated from the provider's schema.
Related