-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add separated resource for configuring S3 bucket lifecycle rules #283
Comments
+1 |
1 similar comment
+1 |
Please stop using the |
I've started on an impl for this feature but per the discussion in: #916 it seems that this resource would most likely not get merged in Thoughts on whether I should continue? |
I stopped immediately when I posted that. I don't know if that code still exists, someone else should take a crack though |
+1 |
Not sure if this is related enough, but I have the case where there's one leading bucket that I want to replicate to a follower bucket for every each new region that we expand to. Ideally, the replication is hence part of the follower hcl, and replication rules can be attached to the leading bucket from there. |
Any updates on this? Numerous +1s over the past 2 years, yet still no solution I've found. Current Terraform Version
Use-casesCreate and add lifecycle policies to an s3 bucket that was not created by terraform. A common use case is a project that needs a bucket and stores files in it, but the bucket is shared by multiple terraform projects where none of them own the bucket. This configuration prevents any individual project from destroying the bucket, but currently does not allow them to all manage their own necessary lifecycle policies for object deletion. e.g. if I have a bucket
and inside I have 2 prefixes,
then I want two separate terraform projects to be able to create independent lifecycle policy rules for their own appropriate namespace e.g. the Attempted SolutionsNo solution available. I would have to create a separate bucket for each terraform project. Not ideal. Proposalallow lifecycle_rule configuration as a separate top-level resource (e.g. ripped from the resource "aws_s3_bucket_lifecycle_rule" "my_rule" {
bucket = "my-bucket"
id = "log"
enabled = true
prefix = "log/"
tags {
"rule" = "log"
"autoclean" = "true"
}
transition {
days = 30
storage_class = "STANDARD_IA" # or "ONEZONE_IA"
}
transition {
days = 60
storage_class = "GLACIER"
}
expiration {
days = 90
}
} References |
@eedwards-sk I wouldn't say that Hashicorp is ignorant on this one. If you followed the Terraform 0.12 blog posts, you might have bumped into the upcoming Dynamic Blocks support. Given this low-level syntax support, there is less the need to extract some of these nested blocks as top level resources. We just have to be a tad more patient. 😉 |
@ringods while that feature looks useful for DRYing up templates, unless I'm missing something, it unfortunately does nothing for solving this issue This issue is for the need for a top-level resource to create bucket lifecycle rules. I'm not looking to make it easier to repeat similar rules across multiple bucket resources, but to be able to create rules for a bucket that the terraform project did not create. |
Is there any movement on this request? Or it makes sense to wait 0.12 with dynamic nested blocks? |
@fizban79 as I commented above, dynamic nested blocks do not solve the issue |
@eedwards-sk agreed, they do not solve all cases of the issue. But their functionality is enough to solve my problems. :) |
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! |
Commenting to keep this open. It'd be fine to merge this with #4418 if that's the decision. |
This functionality has been released in v4.0.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
This issue was originally opened by @pabloajz as hashicorp/terraform#8961. It was migrated here as part of the provider split. The original body of the issue is below.
Add a separate resource aws_s3_bucket_lifecycle_rule for supporting lifecycle rules (http://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html)
Current situation
Lifecycle rules can be defined only inline in the aws_s3_bucket resource, but not as external resources than can be attached to the S3 bucket afterwards
Use Case
I have one S3 bucket containing Logs organised into different keys. Each key is generated by other components (different Log Groups for example). I want to setup different lifecycle rules for each Log Group (Key) when they are created, and they are created dynamically after the S3 bucket is created.
The text was updated successfully, but these errors were encountered: