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

aws_s3_bucket lifecycle_rule should support filter #21953

Closed
kimor79 opened this issue Nov 29, 2021 · 5 comments
Closed

aws_s3_bucket lifecycle_rule should support filter #21953

kimor79 opened this issue Nov 29, 2021 · 5 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@kimor79
Copy link

kimor79 commented Nov 29, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS recently announced support for filtering objects by size in an S3 bucket lifecycle policy. It would be nice if this was also available in the aws_s3_bucket resource.

Example from AWS documentation:

<LifecycleConfiguration>
    <Rule>
        <Filter>
            <ObjectSizeGreaterThan>500</ObjectSizeGreaterThan>   
        </Filter>
        <Status>Enabled</Status>
        transition/expiration actions.
    </Rule>
</LifecycleConfiguration>

New or Affected Resource(s)

  • aws_s3_bucket

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

resource "aws_s3_bucket" "my-bucket" {
  ...

  lifecycle_rule {
    id = "archive"
    enabled = true

    transition {
      days = 90
      storage_class = "GLACIER"
    }

    filter {
      object_size_greater_than = 128000
    }
  }
}

References

@kimor79 kimor79 added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 29, 2021
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/s3 Issues and PRs that pertain to the s3 service. labels Nov 29, 2021
@visit1985
Copy link
Contributor

Maybe we can add the new versions action parameters for noncurrent_version_transition and noncurrent_version_expiration from the same announcement in the same effort.

Potential Terraform Configuration

resource "aws_s3_bucket" "my-bucket" {
  ...

  lifecycle_rule {
    id = "archive"
    enabled = true

    noncurrent_version_transition {
      storage_class = "STANDARD_IA"
      versions = 4
    }

    noncurrent_version_expiration {
      versions = 4
    }
  }
}

References

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Dec 9, 2021
@dhermes
Copy link

dhermes commented Dec 21, 2021

I was just about to file an issue requesting NewerNoncurrentVersions support as well, thanks @visit1985

@pda
Copy link

pda commented May 29, 2022

I see object_size_greater_than and object_size_less_than filters are supported in the aws_s3_bucket_lifecycle_configuration resource type provided by v4.x of hashicorp/terraform-provider-aws.

Landed in d8640c1 / #22579 / v4.0.0 (11 Feb 2022):

resource/aws_s3_bucket: The lifecycle_rule argument has been deprecated and is now read-only. Use the aws_s3_bucket_lifecycle_configuration resource instead. (#22581)

Documentation:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration#specifying-a-filter-based-on-object-size

I imagine there's no intention to backport it onto the v3.x aws_s3_bucket resource, so maybe this issue should close?

A bit more context:

Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label May 18, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

5 participants