Skip to content

Swagger does not allow a stage variable for the account ID #87

@mparaz

Description

@mparaz

I am trying to use this Swagger:

paths:
/documents:
post:
responses: {}
security:
- authorizerFunc: []
x-amazon-apigateway-integration:
uri: arn:aws:apigateway:ap-southeast-2:lambda:path/2015-03-31/functions/arn:aws:lambda:ap-southeast-2:${stageVariables.AccountId}:function:${stageVariables.PostFunctionName}/invocations
passthroughBehavior: "when_no_match"
httpMethod: "POST"
type: "aws_proxy"

with the corresponding template:

Resources:

Explicit API Gateway definition needed for the Custom Authorizer.

ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
DefinitionUri: swaggerFile.yaml
StageName: Prod
Variables:
PostFunctionName: !Ref PostFunction
AccountId: 1234567890

But I get a CloudFormation stack event with:

"ResourceStatusReason": "Errors found during import:\n\tUnable to put integration on 'POST' for resource at path '/documents': Lambda function ARN must be in same account"

It works fine when I put the literal AccountId 1234567890 in the URI.

It looks like the stageVariable reference isn't expanded, is that right?

Thanks!

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