By using AWS re:Post, you agree to the AWS re:Post Terms of Use

CFN template: how to use Type List using VPC ids?

0

i know it's allowed to have a list of VPC as params

I would like to add a default value, choosing the one I exported from another stack

  VPC:
    Type: List<AWS::EC2::VPC::Id>
    Default:
      - !ImportValue Network-V1-VPC

I kindly ask you how can I be sure user is choosing only ONE element?

And how can I use the selected value (or the first one if multiple if I cannot avoid this) ?

1 Answer
0

Hello.

As of May 2024, CloudFromation built-in functions cannot be used in the parameters section.
This means that the "!ImportValue" function cannot be used in the parameter section.
Therefore, the template you are trying to use will result in an error.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html

You can use intrinsic functions only in specific parts of a template. Currently, you can use intrinsic functions in resource properties, outputs, metadata attributes, and update policy attributes. You can also use intrinsic functions to conditionally create stack resources.

profile picture
EXPERT
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions