gpt4 book ai didi

amazon-web-services - 在 Cloudformation 中将 DependsOn 与 Fn::ImportValue 结合使用

转载 作者:行者123 更新时间:2023-12-03 15:50:43 26 4
gpt4 key购买 nike

是否可以像这样将 DependsOn 与 Fn::ImportValue 一起使用?

"DependsOn": {"Fn::ImportValue": {
"Fn::Sub": "${MyStack1}-VPCGatewayAttachment"
}}

具体来说,我的 VPC 和 InternetGatewayAttachment 位于一个堆栈中。我将此堆栈导入到 Stack2 中,其中有我的 ELB,并且我尝试使用 DependsOn 来依赖此附件

最佳答案

您不应该使用DependsOn像这样。仅当在模板内的资源之间创建依赖关系时才需要它。具体来说,它用于覆盖 Cloudformation 创建资源的顺序。

FN::ImportValue 本质上是一个依赖函数,因为导出值必须在堆栈生成之前存在。因此,只需在适当的资源中引用您的导入值即可。

关于amazon-web-services - 在 Cloudformation 中将 DependsOn 与 Fn::ImportValue 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41084223/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com