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: Attach bucket policy for S3 endpoints #341

Closed
wants to merge 4 commits into from

Conversation

lliknart
Copy link

Description

In case where s3 endpoints are enable, you could now attach a policy for this endpoint.
For exemple:

data "aws_iam_policy_document" "s3-access" {
  policy_id = "S3Access"
  version   = "2012-10-17"

  statement {
    sid    = "ReadAccess"
    effect = "Allow"
    principals {
      type        = "AWS"
      identifiers = ["*"]
    }
    actions = [
      "s3:GetObject",
    ]
    resources = [
      "arn:aws:s3:::my-bucket-in-read-only/*",
    ]
  }

  statement {
    sid    = "WriteAccess"
    effect = "Allow"
    principals {
      type        = "AWS"
      identifiers = ["*"]
    }
    actions = [
      "s3:PutObject",
    ]
    resources = [
      "arn:aws:s3:::my_first_bucket/*",
      "arn:aws:s3:::my_second_bucket/*",
    ]
  }
}

you could use the following lines to attach this policy to the S3 endpoint:

module "vpc_with_s3_endpoints" {
  source = "****"
  [...]
  enable_s3_endpoint = true
  s3_endpoint_policy = data.aws_iam_policy_document.s3-access.json
  [...]

add policy configuration for S3 endpoints
@lliknart lliknart requested a review from antonbabenko January 23, 2020 11:26
@patoarvizu
Copy link

Friendly ping on this... is there anything holding it back (other than the branch being out of date)?

@lliknart lliknart changed the title Add policy for S3 endpoints feat: Attach bucket policy for S3 endpoints Jul 17, 2020
Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the PR @lliknart ! could you update the complete-vpc to reflect your proposed changes here and make sure the changes work successfully by provisioning the example please? we will need to make sure that the default behavior does not disrupt existing users, while allowing users the ability to provide a custom policy. thank you!

variable "s3_endpoint_policy" {
description = "Provide a policy for the S3 endpoint"
type = string
default = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this fail if users do not provide a policy - I think this should perhaps be null instead.

@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 Oct 31, 2022
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.

3 participants