fn :: importValue在简短的符号中不喜欢fn :: sub

发布于 2025-02-11 19:04:22 字数 667 浏览 0 评论 0原文

为什么以下格式不正常出现错误“ fn :: importValue中的属性必须是返回字符串的字符串或函数”?

    Source: !Join [":", [!ImportValue [!Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionArn"], !ImportValue [!Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionAlias"]]]

但是,如果我将其重写为:

    Source: !Join
      - ":"
      - - Fn::ImportValue: !Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionArn"
        - Fn::ImportValue: !Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionAlias"

Why is following format not working giving error "the attribute in Fn::ImportValue must be a string or a function that returns a string"?

    Source: !Join [":", [!ImportValue [!Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionArn"], !ImportValue [!Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionAlias"]]]

but it works if I rewrite it as:

    Source: !Join
      - ":"
      - - Fn::ImportValue: !Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionArn"
        - Fn::ImportValue: !Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionAlias"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柠栀 2025-02-18 19:04:22

当它包含一个!sub。

时,您无法使用!

AWS没有提供其内部实现的详细信息,为什么它们以这种方式实现importValue

The docs explain:

You can't use the short form of !ImportValue when it contains a !Sub.

AWS does not provide details of its internal implementations, why they implemented ImportValue this way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文