Skip to content

aws_s3_bucket_lifecycle_configuration regression starting in 5.90.0 #43439

@jrobison-sb

Description

@jrobison-sb

Terraform and AWS Provider Version

$ terraform version
Terraform v1.12.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.89.0


And also:
$ terraform version
Terraform v1.12.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v6.3.0

Affected Resource(s) or Data Source(s)

  • aws_s3_bucket_lifecycle_configuration

Expected Behavior

Upgrading from v5.89.0 to 6.3.0 should not break existing aws_s3_bucket_lifecycle_configuration resources.

Actual Behavior

Upgrading from v5.89.0 to 6.3.0 does break existing aws_s3_bucket_lifecycle_configuration resources.

Relevant Error/Panic Output

N/A

Sample Terraform Configuration

Click to expand configuration
provider "aws" {
  region = "us-east-1"
}

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.89.0"
    }
  }
}

resource "aws_s3_bucket" "bucket" {
  bucket_prefix = "tf-aws-43439-"

  tags = {
    Name        = "tf-aws-43439"
  }
}

resource "aws_s3_bucket_lifecycle_configuration" "example" {
  # This is pasted almost verbatim from the first example
  # in the 5.89.0 docs: https://registry.terraform.io/providers/hashicorp/aws/5.89.0/docs/resources/s3_bucket_lifecycle_configuration#with-neither-a-filter-nor-prefix-specified
  # And also the first example in the 6.3.0 docs: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration#with-neither-a-filter-nor-prefix-specified 
  bucket = aws_s3_bucket.bucket.id

  rule {
    id     = "delete-after-7-days"
    status = "Enabled"

    expiration {
      days = 7
    }
  }
}

Steps to Reproduce

  1. Apply the infrastructure as seen above using v5.89.0, which will apply correctly as expected.
  2. Run a terraform plan, still using 5.89.0, and see that there are no outstanding diffs, also as expected.
  3. Change the version pin to 6.3.0 and rm -f .terraform.lock.hcl && terraform init to get it installed.
  4. Run another terraform plan and see that your configuration is now invalid, even though it matches the docs almost verbatim.
$ terraform plan
aws_s3_bucket.bucket: Refreshing state... [id=tf-aws-43439-20250717194649645400000001]
aws_s3_bucket_lifecycle_configuration.example: Refreshing state... [id=tf-aws-43439-20250717194649645400000001]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no
differences, so no changes are needed.
╷
│ Warning: Invalid Attribute Combination
│
│   with aws_s3_bucket_lifecycle_configuration.example,
│   on main.tf line 22, in resource "aws_s3_bucket_lifecycle_configuration" "example":
│   22: resource "aws_s3_bucket_lifecycle_configuration" "example" {
│
│ No attribute specified when one (and only one) of [rule[0].filter,rule[0].prefix] is required
│
│ This will be an error in a future version of the provider

Debug Logging

Click to expand log output
N/A

GenAI / LLM Assisted Development

n/a

Important Facts and References

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