-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat: Added outputs for s3 bucket lifecycle rules and policy #234
feat: Added outputs for s3 bucket lifecycle rules and policy #234
Conversation
outputs.tf
Outdated
|
||
output "s3_bucket_policy" { | ||
description = "The policy of the bucket, if the bucket is configured with a policy. If not, this will be an empty string." | ||
value = try(jsondecode(aws_s3_bucket_policy.this[0].policy), "") |
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.
value = try(jsondecode(aws_s3_bucket_policy.this[0].policy), "") | |
value = try(aws_s3_bucket_policy.this[0].policy, "") |
outputs.tf
Outdated
@@ -23,6 +23,16 @@ output "s3_bucket_hosted_zone_id" { | |||
value = try(aws_s3_bucket.this[0].hosted_zone_id, "") | |||
} | |||
|
|||
output "s3_bucket_lifecycle_configuration_rules" { | |||
description = "The lifecycle rules of the bucket, if the bucket is configured with lifecycle rules. If not, this will be an empty string." | |||
value = try(jsondecode(jsonencode(aws_s3_bucket_lifecycle_configuration.this[0].rule)), "") |
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.
value = try(jsondecode(jsonencode(aws_s3_bucket_lifecycle_configuration.this[0].rule)), "") | |
value = try(aws_s3_bucket_lifecycle_configuration.this[0].rule, "") |
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.
Looks great. I did the jsonencode / jsondecode for my own personal needs but your changes are more appropriate for a broader audience.
## [3.11.0](v3.10.1...v3.11.0) (2023-05-25) ### Features * Added outputs for s3 bucket lifecycle rules and policy ([#234](#234)) ([24b88e8](24b88e8))
This PR is included in version 3.11.0 🎉 |
I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
This PR creates two new outputs: 1) a list of lifecycle rules applied to the s3 bucket and, 2) the policy applied to the s3 bucket. Each output is set to an empty string if its respective value is not provided.
Additionally, this PR removes the deprecated
skip_get_ec2_platforms
argument from the aws providers in all examples directories.Motivation and Context
While creating tests for my own S3 modules, I ran into a trouble when trying to validate lifecycle rules and policies applied to my S3 bucket. I was able to output the
data_iam_policy_document
easily enough but lifecycle rules are not available as a data source. My workaround was configuring the proper result in Go itself but it would be much better to output these values in case anyone wants to use them; for tests in my case.Additionally, while running the pre-commit for these outputs, the validations were failing because the
skip_get_ec2_platforms
argument is not longer supported using Terraform version 1.4.5, the version used to perform all tests. To pass all validation checks, theskip_get_ec2_platforms
argument was removed from the following examples directories:Breaking Changes
No.
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull request