gpt4 book ai didi

aws-cloudformation - 每个 DependsOn 值必须是字符串 - 如何分解 DependsOn 属性的映射

转载 作者:行者123 更新时间:2023-12-03 07:21:07 25 4
gpt4 key购买 nike

我正在使用explode transform宏按以下方式进行。

  ServiceMap:
Private:
Prefix: Private
Public:
Prefix: Public

Service:
ExplodeMap: ServiceMap
Type: AWS::ECS::Service
DependsOn:
- !Sub 'LoadBalancerRule${!Explode Prefix}'
Properties:
Cluster: !Ref "ECSCluster"
...
TaskDefinition: !Ref TaskDefinition!Explode Prefix
LoadBalancers:
- ContainerName: !Sub '!Explode Prefix${ServiceName}'
ContainerPort: !Ref "ContainerPort"
TargetGroupArn: !Ref TargetGroup!Explode Prefix

LoadBalancerRule:
ExplodeMap: ServiceMap
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
Actions:
...
ListenerArn: !Ref "LoadBalancerListener"
Priority: !Ref "Priority"

这似乎是成功的,但对于 DependsOn 属性中指定的转换。当我创建堆栈时,这是我收到的错误:

Template format error: Every DependsOn value must be a string.

问题:- 我不知道如何实际查看转换后的模板- 为什么会发生这种情况?根据文档,!Sub创建一个字符串

有什么想法

最佳答案

不太确定 !Sub 'LoadBalancerRule${!Explode Prefix}'- LoadBalancerRule!Explode Prefix 之间有什么区别,但这解决了

  Service:
ExplodeMap: ServiceMap
Type: AWS::ECS::Service
DependsOn:
- LoadBalancerRule!Explode Prefix
Properties:
Cluster: !Ref "ECSCluster"
...
TaskDefinition: !Ref TaskDefinition!Explode Prefix
LoadBalancers:
- ContainerName: !Sub '!Explode Prefix${ServiceName}'
ContainerPort: !Ref "ContainerPort"
TargetGroupArn: !Ref TargetGroup!Explode Prefix

关于aws-cloudformation - 每个 DependsOn 值必须是字符串 - 如何分解 DependsOn 属性的映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60391981/

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