问题
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