-
Notifications
You must be signed in to change notification settings - Fork 1
Add optional lifecycle configuration to stackit-object-storage #28
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
base: main
Are you sure you want to change the base?
Conversation
HartmannVolker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I have a couple of remarks regarding the naming and sensible defaults.
To fix the pipeline you need to run terraform-docs markdown . --output-file=README.md --hide-empty in the module to update the README
stackit-object-storage/variables.tf
Outdated
| variable "lifecycle_days" { | ||
| description = "Lifespan of stored data. Data will be deleted after specified value in days. Default value is 0 (no automatic deletion)" | ||
| type = number | ||
| default = 0 | ||
| validation { | ||
| condition = var.lifecycle_days >= 0 | ||
| error_message = "The value for lifecycle in days must be 0 (deactivated) or a positive number." | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to to rename this to object_expiration_days. Additional the default should be null, it might be a valid use case to set the expiration to 0 to clean up large buckets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Good idea!!
So we could ,e.g., create an expiration condition with a past date, if days is set to 0?
stackit-object-storage/main.tf
Outdated
| } | ||
|
|
||
| resource "aws_s3_bucket_lifecycle_configuration" "bucket_lifecycle" { | ||
| count = var.lifecycle_days > 0 ? 1 : 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the default it null this condition should be changed to `var.lifecycle_days != null ? 1 : 0
…e-lifecycle-configuration # Conflicts: # stackit-object-storage/README.md
|
Thanks for the Review! I overlooked the terraform-docs command in the Readme, thanks for pointing this out. PR is updated |
No description provided.