Skip to content

Commit 96c39eb

Browse files
authored
Merge pull request #43590 from johannes-gehrs/b-fix_misleading_lifecyle_rule_warning
Fix misleading S3 Lifecycle rule warning
2 parents 3656e8a + 015e300 commit 96c39eb

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
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: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ 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+
When you don't specify a filter or prefix, the lifecycle rule applies to all objects in the bucket. This has the same effect as setting an empty `filter` element.
3232

33-
This configuration is intended to replicate the default behavior of the `lifecycle_rule`
34-
parameter in the Terraform AWS Provider `aws_s3_bucket` resource prior to `v4.0`.
33+
This configuration maintains compatibility with the default behavior of the `lifecycle_rule` parameter from the `aws_s3_bucket` resource in versions prior to v4.0 of the Terraform AWS Provider.
3534

3635
```terraform
3736
resource "aws_s3_bucket_lifecycle_configuration" "example" {
@@ -384,16 +383,12 @@ The `rule` configuration block supports the following arguments:
384383
* `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).
385384
* `filter` - (Optional) Configuration block used to identify objects that a Lifecycle Rule applies to.
386385
[See below](#filter).
387-
If not specified, the `rule` will default to using `prefix`.
388-
One of `filter` or `prefix` should be specified.
389386
* `id` - (Required) Unique identifier for the rule. The value cannot be longer than 255 characters.
390387
* `noncurrent_version_expiration` - (Optional) Configuration block that specifies when noncurrent object versions expire. [See below](#noncurrent_version_expiration).
391388
* `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).
392389
* `prefix` - (Optional) **DEPRECATED** Use `filter` instead.
393390
This has been deprecated by Amazon S3.
394391
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.
397392
* `status` - (Required) Whether the rule is currently being applied. Valid values: `Enabled` or `Disabled`.
398393
* `transition` - (Optional) Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. [See below](#transition).
399394

0 commit comments

Comments
 (0)