Skip to content
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: Stop requiring s3:ListAllMyBuckets IAM permission unless needed (for bucket ACL) #243

Conversation

theipster
Copy link
Contributor

@theipster theipster commented Jul 14, 2023

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 the var.owner["id"] value isn't available.

Motivation and Context

As per the data.aws_canonical_user_id documentation, this data source requires the s3: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:

  • the module interface (i.e. input and output variables) has not changed; and,
  • for existing use cases where the IAM entity already has the s3:ListAllMyBuckets permission, the module will continue to behave as before except simply skip the ListBuckets S3 API calls.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s) - No interface changes.
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@theipster theipster changed the title fix: Don't require s3:ListAllMyBuckets IAM permission unless needed. fix: Stop requiring s3:ListAllMyBuckets IAM permission unless needed. Jul 14, 2023
@theipster theipster force-pushed the skip-list-my-buckets-permission branch 2 times, most recently from ef20375 to f99ead3 Compare July 20, 2023 00:07
@github-actions
Copy link

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Aug 20, 2023
This removes the otherwise unnecessary need for the `s3:ListAllMyBuckets` permission.
If `var.owner["id"]` is provided, then `aws_canonical_user_id` is still not needed.
@theipster theipster force-pushed the skip-list-my-buckets-permission branch from f99ead3 to f2af914 Compare August 20, 2023 14:48
@theipster
Copy link
Contributor Author

Bump please

@github-actions github-actions bot removed the stale label Aug 21, 2023
@antonbabenko antonbabenko changed the title fix: Stop requiring s3:ListAllMyBuckets IAM permission unless needed. fix: Stop requiring s3:ListAllMyBuckets IAM permission unless needed (for bucket ACL) Aug 22, 2023
@antonbabenko antonbabenko changed the title fix: Stop requiring s3:ListAllMyBuckets IAM permission unless needed (for bucket ACL) feat: Stop requiring s3:ListAllMyBuckets IAM permission unless needed (for bucket ACL) Aug 22, 2023
@antonbabenko antonbabenko merged commit 74fcc60 into terraform-aws-modules:master Aug 22, 2023
16 checks passed
antonbabenko pushed a commit that referenced this pull request Aug 22, 2023
## [3.15.0](v3.14.1...v3.15.0) (2023-08-22)

### Features

* Stop requiring `s3:ListAllMyBuckets` IAM permission unless needed (for bucket ACL) ([#243](#243)) ([74fcc60](74fcc60))
@antonbabenko
Copy link
Member

This PR is included in version 3.15.0 🎉

udyavar pushed a commit to udyavar/terraform-aws-s3-bucket that referenced this pull request Aug 29, 2023
…ovisionerBrokenSSH

Ubuntu 2204 broke SSH connectivity fix key type
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants