Skip to content

s3_bucket_lifecycle_configuration Warning: Invalid Attribute Combination #42515

@jaw111

Description

@jaw111

Terraform and AWS Provider Version

OpenTofu v1.9.1
on linux_amd64

hashicorp/aws 5.97

Affected Resource(s) or Data Source(s)

  • s3_bucket_lifecycle_configuration

Expected Behavior

It should be possible to specify an empty filter per the example in the documentation.

Actual Behavior

I see a warning that this will be an error in a future version of the provider.

Relevant Error/Panic Output


│ Warning: Invalid Attribute Combination

│   with aws_s3_bucket_lifecycle_configuration.example,
│   on s3.tf line 16, in resource "aws_s3_bucket_lifecycle_configuration" "example":
│   16:     filter {}

│ No attribute specified when one (and only one) of
│ [rule[0].filter[0].prefix.<.object_size_greater_than,rule[0].filter[0].prefix.<.object_size_less_than,rule[0].filter[0].prefix.<.and,rule[0].filter[0].prefix.<.tag]
│ is required

│ This will be an error in a future version of the provider

│ (and one more similar warning elsewhere)

Sample Terraform Configuration

Click to expand configuration
resource "aws_s3_bucket_lifecycle_configuration" "example" {
  bucket = aws_s3_bucket.bucket.id

  rule {
    id = "30-day-lifecycle"

    filter {}

    expiration {
      days = 30
    }

    status = "Enabled"
  }
}

Steps to Reproduce

  1. Apply the configuration.

Debug Logging

Click to expand log output

GenAI / LLM Assisted Development

n/a

Important Facts and References

No response

Would you like to implement a fix?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/s3Issues and PRs that pertain to the s3 service.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions