-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
fix s3 bucket versioning #77
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,12 @@ resource "aws_s3_bucket" "default" { | |
policy = var.policy | ||
tags = module.this.tags | ||
|
||
versioning { | ||
enabled = var.versioning_enabled | ||
dynamic "versioning" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error Description: Ensure all data stored in the S3 bucket have versioning enabled |
||
for_each = var.bucket_versioning ? [1] : [0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have two separate boolean variables here? Let's use the original version_enabled in the dynamic and when setting the value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Long time ago, but as I remember... cause versioning can be enabled or disabled for bucket. In case versioning is enabled, it could be set to suspended. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that's relevant here tho as you can still suspend versioning on the bucket by toggling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm after fully understanding the aws provider issue you linked to, perhaps I'm mistaken. This seems to be a workaround for an upstream bug but I don't know if we want to support this workaround or wait for the bug to be fixed upstream. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are referring to aws provider issue, well it's more then 3y old, I wouldn't expect it to be fixed. And as I mentioned there are 4 states of versioning for S3 buckets, aws provider seems reflects exactly that behavior. So I'm not sure if it's a bug at all.. |
||
|
||
content { | ||
enabled = var.versioning_enabled | ||
} | ||
} | ||
|
||
lifecycle_rule { | ||
|
@@ -74,7 +78,9 @@ resource "aws_s3_bucket" "default" { | |
for_each = var.enable_current_object_expiration ? [1] : [] | ||
|
||
content { | ||
days = var.expiration_days | ||
days = var.expiration_days | ||
date = var.expiration_date | ||
expired_object_delete_marker = var.expiration_expired_object_delete_marker | ||
} | ||
} | ||
} | ||
|
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.
Error Description: Ensure all data stored in the S3 bucket is securely encrypted at rest
Category: Storage | Severity: HIGH
Resource: aws_s3_bucket [default], lines: 1 - 156