Link Search Menu Expand Document

Table of contents

Select

The Fn::Select function in CloudFormation selects a single value from a list of values given an index.

Info on Fn::Select from AWS can be found here

In KloudFormation you can use the Select class.

val vpcId = parameter<String>("VPCID")
val dbSubnetIpBlocks = parameter("DbSubnetIpBlocks", ParameterType.CommaDelimitedListParameter, default = "10.0.48.0/24, 10.0.112.0/24, 10.0.176.0/24")
subnet(Select(+"0", Reference(dbSubnetIpBlocks.logicalName)), vpcId.ref())

Produces

Parameters:
  VPCID:
    Type: "String"
  DbSubnetIpBlocks:
    Type: "CommaDelimitedList"
    Default: "10.0.48.0/24, 10.0.112.0/24, 10.0.176.0/24"
Resources:
  Subnet:
    Type: "AWS::EC2::Subnet"
    Properties:
      CidrBlock:
        Fn::Select:
        - "0"
        - Ref: "DbSubnetIpBlocks"
      VpcId:
        Ref: "VPCID"