Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Provider version v5.86.0 caused a regression in S3 lifecycle configuration: provider ... produced an │ unexpected new value: .rule[0].filter: block count changed from 1 to 0. #41278

Closed
jlewis-spotnana opened this issue Feb 7, 2025 · 8 comments · Fixed by #41296
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@jlewis-spotnana
Copy link

jlewis-spotnana commented Feb 7, 2025

Terraform Core Version

1.5.7

AWS Provider Version

5.86.0

Affected Resource(s)

  • aws_s3_bucket_lifecycle_configuration

Expected Behavior

After upgrading to provider v5.86.0, I expected terraform plan and terraform apply to run successfully without drift or error.

Actual Behavior

After upgrading to provider v5.86.0 the following diff is observed in terraform plan, resulting in the error shown below under "Relevant Error/Panic Output Snippet"

  # module.s3_buckets.module.s3_buckets["mybucket"].aws_s3_bucket_lifecycle_configuration.this[0] will be updated in-place
  ~ resource "aws_s3_bucket_lifecycle_configuration" "this" {
        id                                     = "mybucket"
      ~ transition_default_minimum_object_size = "varies_by_storage_class" -> "all_storage_classes_128K"
        # (1 unchanged attribute hidden)

        # (3 unchanged blocks hidden)
    }

Relevant Error/Panic Output Snippet

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ module.s3_buckets.module.s3_buckets["mybucket"].aws_s3_bucket_lifecycle_configuration.this[0],
│ provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an
│ unexpected new value: .rule[0].filter: block count changed from 1 to 0.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "= 5.86.0"
    }
  }
  required_version = "~> 1.5.7"
}

provider "aws" {
  region = "us-west-2"
  default_tags {
    tags = {
      env       = "jlewis"
      terraform = "true"
    }
  }
}

resource "aws_s3_bucket" "this" {
  bucket = "test-bucket-123"

  force_destroy       = false
  object_lock_enabled = false
  tags = {
    Name      = "jlewis-test-123456789012"
    env       = "jlewis"
    terraform = "true"
  }
}


resource "aws_s3_bucket_lifecycle_configuration" "this" {
  bucket                                 = aws_s3_bucket.this.id
  transition_default_minimum_object_size = "varies_by_storage_class"

  rule {
    id     = "delete-incomplete-multipart-uploads"
    status = "Enabled"
    abort_incomplete_multipart_upload {
      days_after_initiation = 7
    }
    filter {}
  }

  rule {
    id     = "purge-1"
    status = "Enabled"
    expiration {
      days = 30
    }

    filter {
      prefix = "prefix-1/"
    }
  }

  rule {
    id     = "purge-2"
    status = "Enabled"
    expiration {
      days = 5
    }
    filter {
      prefix = "prefix-2/"
    }
  }

}

Steps to Reproduce

There are several ways to reproduce this issue. Here is one.

  1. Run the above terraform code to create a bucket and Lifecycle rule
  2. Remove transition_default_minimum_object_size or set transition_default_minimum_object_size = null
  3. Run terraform apply again, and the error will result
  4. Run terraform apply a second time, and the configuration will be applied successfully and without error.

Debug Output

No response

Panic Output

No response

Important Factoids

This may be related to PR #41159

Interestingly, running terraform apply a second time applies the configuration correctly and without error.

Reverting to AWS provider v5.85.0 also results in expected behavior.

References

No response

Would you like to implement a fix?

No

@jlewis-spotnana jlewis-spotnana added the bug Addresses a defect in current functionality. label Feb 7, 2025
Copy link

github-actions bot commented Feb 7, 2025

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/s3 Issues and PRs that pertain to the s3 service. needs-triage Waiting for first response or review from a maintainer. labels Feb 7, 2025
@baer95
Copy link

baer95 commented Feb 7, 2025

This looks like a duplicate of #41268, can you confirm?

@jlewis-spotnana
Copy link
Author

Regarding #41268 the error message is certainly the same, but I don't see any mention of input transition_default_minimum_object_size.

@gdavison
Copy link
Contributor

gdavison commented Feb 7, 2025

@jlewis-spotnana to clarify, were the bucket and lifecycle rule created with v5.85.0 and the changes applied with v5.86.0, or was it both created and updated with v5.86.0?

@dejwsz
Copy link

dejwsz commented Feb 10, 2025

I had the same error but when I re-applied my tf spec it went ok, weird - for me the same TF 1.5.7 and aws provider 5.86.0, while with the previous versions of aws providers I do not had such issues.

@jlewis-spotnana
Copy link
Author

@gdavison I could re-produce this issue using v5.86.0 alone. But also, creating buckets with v5.85.0 and then upgrading to v.5.86.0 also results in the same behavior.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.87.0 milestone Feb 10, 2025
@gdavison gdavison modified the milestones: v5.87.0, v5.86.1 Feb 10, 2025
@mark-jordanovic-lewis
Copy link

v5.86.1 did not fix the issue. Seen here:
Screenshot 2025-02-11 at 10 44 17
Screenshot 2025-02-11 at 10 46 25

Strangley this did not show up in all resources. The reason may be that aws_s3_bucket_lifecycle_configurations were imported on AWS version bump to v5.x.x and the original buckets were created from v3.3.9 to the latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
6 participants