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

Provide custom policy and cors configuration through serverless config #175

Open
mdnorman opened this issue Sep 30, 2022 · 0 comments
Open

Comments

@mdnorman
Copy link

Is your feature request related to a problem? Please describe.
I'd rather not keep multiple complete copies of a custom policy and cors configuration around. So, instead I end up telling serverless-finch to not stomp over the custom policy and cors that I set up within my serverless yaml.

In fact, for some configuration, for example CloudFrontOriginAccessIdentity, I'm not able to use a static json file at all because I need the WebAppCloudFrontOriginAccessIdentity.S3CanonicalUserId to provide to the custom policy.

For instance, this is an example of my policy in yaml:

    WebAppCloudFrontOriginAccessIdentity:
      Type: AWS::CloudFront::CloudFrontOriginAccessIdentity
      Properties:
        CloudFrontOriginAccessIdentityConfig:
          Comment: ${self:service}-${self:custom.stage}-oai

    WebAppS3BucketPolicy:
      Type: AWS::S3::BucketPolicy
      Properties:
        Bucket: !Ref WebAppS3Bucket
        PolicyDocument:
          Statement:
            - Action: 's3:Get*'
              Effect: Allow
              Resource: 'arn:aws:s3:::${self:custom.client.bucketName}/*'
              Principal:
                CanonicalUser: !GetAtt WebAppCloudFrontOriginAccessIdentity.S3CanonicalUserId

Describe the solution you'd like
I'd like a way to provide custom policy and cors within my current serverless configuration, so I can use variable interpolation from the serverless config as well as results from cloudformation itself.

Describe alternatives you've considered
Supporting variable interpolation within the json files might work for some instances, but it gets more difficult when attempting to get CloudFormation results, so there would need to be an example for that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant