简体   繁体   English

Cloudformation 如何在 Sub 内部的 ImportValue 内部进行 Sub?

[英]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.我试图在引用参数 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.问题代码结构中使用的对我有用,因此,如评论中所述,该问题与Sub / ImportValue优先级或格式无关。

  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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 cloudformation 中的 yaml 中的 json 中使用 Fn::ImportValue - use Fn::ImportValue inside a json which is inside a yaml in cloudformation 如何在 cloudformation 中引用 ImportValue 中的变量? - How can I ref a variable in ImportValue in cloudformation? CloudFormation - 使用 - >- 表达式和 !Sub - CloudFormation - Using - >- expression with !Sub ParameterOverride CodePipeline 中的 Cloudformation ImportValue - Cloudformation ImportValue within ParameterOverride CodePipeline 使用方法:Sub 或:Join in "AWS::CloudFormation,:Init", file key - How to use !Sub or !Join in "AWS::CloudFormation::Init", file key 无法使用 !Sub 解析 cloudformation 模板 - Unable to resolve cloudformation template using !Sub 如何在具有多个子目录的 zip 文件中找到具有最大日期/时间的文件 - how to find the file with max date/time inside a zip file having more than one sub directories 1 mb 的大小限制是否适用于 Firestore 文档内的子集合? - Does 1 mb size limit apply to a sub collection in inside a document in Firestore? 如何在另一个堆栈参数中导入 cloudformation 堆栈 output? - How to import cloudformation stack output inside another stack parameter? 如何在信任关系中导入值 - How to ImportValue in trust relationship
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM