gpt4 book ai didi

arrays - Fn::ImportValue 与类型 {Array} 不匹配

转载 作者:行者123 更新时间:2023-12-04 01:51:53 26 4
gpt4 key购买 nike

我在使用 CloudFormation 中的导出和导入功能时遇到问题。当我尝试导入实际上是列表(数组)的值时,我收到以下错误消息“与类型 {Array} 不匹配”。

vpc.yaml(片段)

PrivateSubnets:
Description: A list of the private subnets
Value: !Join [",", [!Ref PrivateSubnetOne, !Ref PrivateSubnetTwo]]
Export:
Name: !Join ["-", [!Ref "Environment", "PrivateSubnets"] ]

pipeline.yaml(片段)

Subnets:
Fn::ImportValue: !Sub "${Environment}-PrivateSubnets"

错误消息:

    Property validation failure: [Value of property {/VpcConfig/Subnets} does not match type {Array}

最佳答案

此代码解决了问题;

Subnets: !Split 
- ","
- Fn::ImportValue:
!Sub "${Environment}-PrivateSubnets"

关于arrays - Fn::ImportValue 与类型 {Array} 不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52601220/

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