feat: Stop requiring s3:ListAllMyBuckets
IAM permission unless needed (for bucket ACL)
#243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This skips executing the
data.aws_canonical_user_id.this
data source unless it is actually needed.The data source is only needed when the
aws_s3_bucket_acl.this
resource needs to be created and thevar.owner["id"]
value isn't available.Motivation and Context
As per the
data.aws_canonical_user_id
documentation, this data source requires thes3:ListAllMyBuckets
IAM permission. Note that this permission isn't required by anything else in this module.When the data source isn't needed, then by the principle of least privilege, we shouldn't require the
s3:ListAllMyBuckets
permission.This additional permission is particularly obvious when migrating existing
aws_s3_*
resources into this module.Breaking Changes
Not a breaking change:
s3:ListAllMyBuckets
permission, the module will continue to behave as before except simply skip theListBuckets
S3 API calls.How Has This Been Tested?
examples/*
to demonstrate and validate my change(s) - No interface changes.examples/*
projectspre-commit run -a
on my pull request