简体   繁体   中英

Cloudformation how to Sub inside of a ImportValue inside of a Sub?

I feel I have tried just about every combination for this to work, and have come up empty handed. Has anyone done this? I am trying to reference an import value inside of a sub while referencing the the parameter ApiStack. Appreciate any advice!

LambdaPermission:
    Type: AWS::Lambda::Permission
    Properties:
      Action: lambda:InvokeFunction
      FunctionName: !GetAtt MyLambdaFunction.Arn
      Principal: apigateway.amazonaws.com
      SourceArn: !Sub 
                    - arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ApiGateway}/*/POST/CreateBofAParameter
                    - ApiGateway: !ImportValue 
                        'Fn::Sub': '${ApiStack}--APIID'

The same to used in the question code structure worked for me, thus, as mentioned in the comments, the issue is not related to Sub / ImportValue precedence or format.

  Arn: !Sub
    - "arn:aws:elasticfilesystem:${AWS::Region}:${AWS::AccountId}:access-point/${VariableToImport}"
    - VariableToImport: !ImportValue
        'Fn::Sub': "${SubVariable}-some-id"

You have extra ' . It should be:

'Fn::Sub': "${ApiStack}--APIID"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM