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}
                This code resolved the issue;
Subnets: !Split 
   - ","
   - Fn::ImportValue: 
       !Sub "${Environment}-PrivateSubnets"
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With