Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fn::ImportValue does not match type {Array}

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}
like image 762
RyanOz Avatar asked Oct 29 '25 19:10

RyanOz


1 Answers

This code resolved the issue;

Subnets: !Split 
   - ","
   - Fn::ImportValue: 
       !Sub "${Environment}-PrivateSubnets"
like image 109
RyanOz Avatar answered Nov 01 '25 11:11

RyanOz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!