Serverless-application-model: SourceVpcWhitelist is unable to resolve intrinsic functions

Created on 16 Nov 2019  路  3Comments  路  Source: aws/serverless-application-model

Description:

Within the Auth object, trying to use SourceVpcWhitelist and finding that intrinsic functions are causing issues with cloudformation creating or updating a stack.

https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api-auth-object

...
Auth:
  DefaultAuthorizer: AWS_IAM
    ResourcePolicy:
      SourceVpcWhitelist:
        - !Ref VPCEndpoint
...

Steps to reproduce the issue:

  1. Create an Serveless::API with a vpc or vpcendpoint
  2. Put the above into the Auth section for resource policies

Observed result:
Transform AWS::Serverless-2016-10-31 failed with: Internal transform failure.

cfn-lint returns E0001 Error transforming template: expected string or bytes-like object.

Expected result:

Cloudformation updates stack and is able to resolve the intrinsic functions

Note
If you do not use intrinsic functions like !Sub or !Ref this works fine
I have not tried this on the other options. I have tried with CustomStatements and had no issues

typbug

Most helpful comment

馃憢
Any update on this?
I'm also experiencing this issue, the workaround I have for now is an ugly custom statement.

Auth:
  ResourcePolicy:
    CustomStatements:
      - Effect: Allow
        Principal: '*'
        Action: execute-api:Invoke
        Resource: execute-api:/*
      - Effect: Deny
        Principal: '*'
        Action: execute-api:Invoke
        Resource: execute-api:/*
        Condition:
          StringNotEquals:
            aws:SourceVpce: !Ref VpcEndpoint

All 3 comments

馃憢
Any update on this?
I'm also experiencing this issue, the workaround I have for now is an ugly custom statement.

Auth:
  ResourcePolicy:
    CustomStatements:
      - Effect: Allow
        Principal: '*'
        Action: execute-api:Invoke
        Resource: execute-api:/*
      - Effect: Deny
        Principal: '*'
        Action: execute-api:Invoke
        Resource: execute-api:/*
        Condition:
          StringNotEquals:
            aws:SourceVpce: !Ref VpcEndpoint

Having the same issue. Going to hardcode the vpc until this is solved. I got lucky that it's not an issue for me yet.

I have ran into this issue as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zeroastro picture zeroastro  路  3Comments

restfulhead picture restfulhead  路  4Comments

kwcrook picture kwcrook  路  3Comments

vinkris picture vinkris  路  3Comments

feinstein picture feinstein  路  3Comments