Skip to content

integration_s3_bucket_policy data source only supports aws partition? #271

Description

@hockeygoonnorm

Problem

When using the integration_s3_bucket_policy data source in AWS GovCloud, the policy generated by the data source only seems to support the AWS commercial partition (aws). The policy generated by this data source always contains a bucket resource with "arn:aws:s3::..."

As a result, Terraform will error with a "api error MalformedPolicy: Policy has invalid resource" error.

Example usage

data "orcasecurity_integration_s3_bucket_policy" "this" {
  arn_or_url = "arn:aws-us-gov:s3:::my-bucket-name"
}

Example Result
NOTE: In resource ARN, the "aws-us-gov" partition has been replaced by "aws".

        {
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Condition": {
                "StringEquals": {
                    "s3:x-amz-acl": "bucket-owner-full-control"
                }
            },
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws-us-gov:iam::247207723357:role/integrations_s3_uploader"
            },
            "Resource": "arn:aws:s3:::my-bucket-name/*"
        }

Expected Result

"Statement": [
        {
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Condition": {
                "StringEquals": {
                    "s3:x-amz-acl": "bucket-owner-full-control"
                }
            },
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws-us-gov:iam::247207723357:role/integrations_s3_uploader"
            },
            "Resource": "arn:aws-us-gov:s3:::my-bucket-name/*"
        }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions