Skip to content

Commit

Permalink
r/s3_bucket_replication_configuration: deprecate rule.prefix paramete…
Browse files Browse the repository at this point in the history
…r as is currently in the S3 API
  • Loading branch information
anGie44 committed Mar 17, 2022
1 parent b01f01d commit 6c9867e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .changelog/23703.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ resource/aws_s3_bucket_replication_configuration: Set `rule.id` as Computed to p

```release-note:bug
resource/aws_s3_bucket_replication_configuration: Change `rule` configuration block to list instead of set
```

```release-note:note:
resource/aws_s3_bucket_replication_configuration: The `rule.prefix` parameter has been deprecated. Use the `rule.filter` parameter instead.
```
1 change: 1 addition & 0 deletions internal/service/s3/bucket_replication_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func ResourceBucketReplicationConfiguration() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringLenBetween(0, 1024),
Deprecated: "Use filter instead",
},
"priority": {
Type: schema.TypeInt,
Expand Down
34 changes: 25 additions & 9 deletions website/docs/r/s3_bucket_replication_configuration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ resource "aws_s3_bucket" "source" {
}
resource "aws_s3_bucket_acl" "source_bucket_acl" {
provider = aws.central
bucket = aws_s3_bucket.source.id
acl = "private"
}
Expand All @@ -124,15 +126,20 @@ resource "aws_s3_bucket_versioning" "source" {
}
resource "aws_s3_bucket_replication_configuration" "replication" {
provider = aws.central
# Must have bucket versioning enabled first
depends_on = [aws_s3_bucket_versioning.source]
role = aws_iam_role.replication.arn
bucket = aws_s3_bucket.source.id
rule {
id = "foobar"
prefix = "foo"
id = "foobar"
filter {
prefix = "foo"
}
status = "Enabled"
destination {
Expand Down Expand Up @@ -160,12 +167,12 @@ resource "aws_s3_bucket_versioning" "east" {
}
resource "aws_s3_bucket" "west" {
provider = west
provider = aws.west
bucket = "tf-test-bucket-west-12345"
}
resource "aws_s3_bucket_versioning" "west" {
provider = west
provider = aws.west
bucket = aws_s3_bucket.west.id
versioning_configuration {
Expand All @@ -181,8 +188,12 @@ resource "aws_s3_bucket_replication_configuration" "east_to_west" {
bucket = aws_s3_bucket.east.id
rule {
id = "foobar"
prefix = "foo"
id = "foobar"
filter {
prefix = "foo"
}
status = "Enabled"
destination {
Expand All @@ -193,15 +204,20 @@ resource "aws_s3_bucket_replication_configuration" "east_to_west" {
}
resource "aws_s3_bucket_replication_configuration" "west_to_east" {
provider = aws.west
# Must have bucket versioning enabled first
depends_on = [aws_s3_bucket_versioning.west]
role = aws_iam_role.west_replication.arn
bucket = aws_s3_bucket.west.id
rule {
id = "foobar"
prefix = "foo"
id = "foobar"
filter {
prefix = "foo"
}
status = "Enabled"
destination {
Expand Down Expand Up @@ -235,7 +251,7 @@ The `rule` configuration block supports the following arguments:
* `existing_object_replication` - (Optional) Replicate existing objects in the source bucket according to the rule configurations [documented below](#existing_object_replication).
* `filter` - (Optional, Conflicts with `prefix`) Filter that identifies subset of objects to which the replication rule applies [documented below](#filter). If not specified, the `rule` will default to using `prefix`.
* `id` - (Optional) Unique identifier for the rule. Must be less than or equal to 255 characters in length.
* `prefix` - (Optional, Conflicts with `filter`) Object key name prefix identifying one or more objects to which the rule applies. Must be less than or equal to 1024 characters in length. Defaults to an empty string (`""`) if `filter` is not specified.
* `prefix` - (Optional, Conflicts with `filter`, **Deprecated**) Object key name prefix identifying one or more objects to which the rule applies. Must be less than or equal to 1024 characters in length. Defaults to an empty string (`""`) if `filter` is not specified.
* `priority` - (Optional) The priority associated with the rule. Priority should only be set if `filter` is configured. If not provided, defaults to `0`. Priority must be unique between multiple rules.
* `source_selection_criteria` - (Optional) Specifies special object selection criteria [documented below](#source_selection_criteria).
* `status` - (Required) The status of the rule. Either `"Enabled"` or `"Disabled"`. The rule is ignored if status is not "Enabled".
Expand Down

0 comments on commit 6c9867e

Please sign in to comment.