Skip to content

Commit 1fda0c5

Browse files
Fix misleading S3 Lifecycle rule warning
1 parent 72b875c commit 1fda0c5

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

.changelog/43590.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/aws_s3_bucket_lifecycle_configuration: Do not warn if no filter element is set
3+
```

internal/service/s3/bucket_lifecycle_configuration.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ func (r *bucketLifecycleConfigurationResource) Schema(ctx context.Context, reque
110110
listvalidator.SizeAtLeast(1),
111111
},
112112
NestedObject: schema.NestedBlockObject{
113-
Validators: []validator.Object{
114-
tfobjectvalidator.WarnExactlyOneOfChildren(
115-
path.MatchRelative().AtName(names.AttrFilter),
116-
path.MatchRelative().AtName(names.AttrPrefix),
117-
),
118-
},
119113
Attributes: map[string]schema.Attribute{
120114
names.AttrID: schema.StringAttribute{
121115
Required: true,

website/docs/r/s3_bucket_lifecycle_configuration.html.markdown

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ See the Amazon S3 User Guide on [setting lifecycle configuration on a bucket](ht
2828

2929
### With neither a filter nor prefix specified
3030

31-
The Lifecycle rule applies to a subset of objects based on the key name prefix (`""`).
31+
The Lifecycle rule applies to all objects in the bucket, i.e. it is equivalent to setting an empty `filter` element.
3232

3333
This configuration is intended to replicate the default behavior of the `lifecycle_rule`
3434
parameter in the Terraform AWS Provider `aws_s3_bucket` resource prior to `v4.0`.
@@ -384,16 +384,12 @@ The `rule` configuration block supports the following arguments:
384384
* `expiration` - (Optional) Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker. [See below](#expiration).
385385
* `filter` - (Optional) Configuration block used to identify objects that a Lifecycle Rule applies to.
386386
[See below](#filter).
387-
If not specified, the `rule` will default to using `prefix`.
388-
One of `filter` or `prefix` should be specified.
389387
* `id` - (Required) Unique identifier for the rule. The value cannot be longer than 255 characters.
390388
* `noncurrent_version_expiration` - (Optional) Configuration block that specifies when noncurrent object versions expire. [See below](#noncurrent_version_expiration).
391389
* `noncurrent_version_transition` - (Optional) Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class. [See below](#noncurrent_version_transition).
392390
* `prefix` - (Optional) **DEPRECATED** Use `filter` instead.
393391
This has been deprecated by Amazon S3.
394392
Prefix identifying one or more objects to which the rule applies.
395-
Defaults to an empty string (`""`) if `filter` is not specified.
396-
One of `prefix` or `filter` should be specified.
397393
* `status` - (Required) Whether the rule is currently being applied. Valid values: `Enabled` or `Disabled`.
398394
* `transition` - (Optional) Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. [See below](#transition).
399395

0 commit comments

Comments
 (0)