Fn::ImportValue does not match type {Array}

删除回忆录丶 提交于 2021-02-10 04:47:39

问题


I faced an issue with using the export and import functionality in CloudFormation. When I tried to import a value which actually is a list (array) I received the following error message "does not match type {Array}".

vpc.yaml (snippet)

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

pipeline.yaml (snippet)

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

Error message:

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

回答1:


This code resolved the issue;

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


来源:https://stackoverflow.com/questions/52601220/fnimportvalue-does-not-match-type-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!