github.com/openshift/installer@v1.4.17/upi/aws/cloudformation/01_vpc_99_subnet.yaml (about)

     1  AWSTemplateFormatVersion: 2010-09-09
     2  Description: Template for Best Practice Subnets (Public and Private)
     3  
     4  Parameters:
     5    VpcId:
     6      Description: VPC ID which the subnets will be part.
     7      Type: String
     8      AllowedPattern: ^(?:(?:vpc)(?:-[a-zA-Z0-9]+)?\b|(?:[0-9]{1,3}\.){3}[0-9]{1,3})$
     9      ConstraintDescription: VPC ID must be with valid name, starting with vpc-.*.
    10    ClusterName:
    11      Description: Cluster Name or Prefix name to prepend the tag Name for each subnet.
    12      Type: String
    13      AllowedPattern: ".+"
    14      ConstraintDescription: ClusterName parameter must be specified.
    15    ZoneName:
    16      Description: Zone Name to create the subnets (Example us-west-2-lax-1a).
    17      Type: String
    18      AllowedPattern: ".+"
    19      ConstraintDescription: ZoneName parameter must be specified.
    20    PublicRouteTableId:
    21      Description: Public Route Table ID to associate the public subnet.
    22      Type: String
    23      AllowedPattern: ".+"
    24      ConstraintDescription: PublicRouteTableId parameter must be specified.
    25    PublicSubnetCidr:
    26      # yamllint disable-line rule:line-length
    27      AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
    28      ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
    29      Default: 10.0.128.0/20
    30      Description: CIDR block for Public Subnet
    31      Type: String
    32  
    33    PrivateRouteTableId:
    34      Description: Public Route Table ID to associate the Local Zone subnet
    35      Type: String
    36      AllowedPattern: ".+"
    37      ConstraintDescription: PublicRouteTableId parameter must be specified.
    38    PrivateSubnetCidr:
    39      # yamllint disable-line rule:line-length
    40      AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
    41      ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
    42      Default: 10.0.128.0/20
    43      Description: CIDR block for Public Subnet
    44      Type: String
    45  
    46  Resources:
    47    PublicSubnet:
    48      Type: "AWS::EC2::Subnet"
    49      Properties:
    50        VpcId: !Ref VpcId
    51        CidrBlock: !Ref PublicSubnetCidr
    52        AvailabilityZone: !Ref ZoneName
    53        Tags:
    54        - Key: Name
    55          Value: !Join ['-', [!Ref ClusterName, "public", !Ref ZoneName]]
    56  
    57    PublicSubnetRouteTableAssociation:
    58      Type: "AWS::EC2::SubnetRouteTableAssociation"
    59      Properties:
    60        SubnetId: !Ref PublicSubnet
    61        RouteTableId: !Ref PublicRouteTableId
    62  
    63    PrivateSubnet:
    64      Type: "AWS::EC2::Subnet"
    65      Properties:
    66        VpcId: !Ref VpcId
    67        CidrBlock: !Ref PrivateSubnetCidr
    68        AvailabilityZone: !Ref ZoneName
    69        Tags:
    70        - Key: Name
    71          Value: !Join ['-', [!Ref ClusterName, "private", !Ref ZoneName]]
    72  
    73    PrivateSubnetRouteTableAssociation:
    74      Type: "AWS::EC2::SubnetRouteTableAssociation"
    75      Properties:
    76        SubnetId: !Ref PrivateSubnet
    77        RouteTableId: !Ref PrivateRouteTableId
    78  
    79  Outputs:
    80    PublicSubnetId:
    81      Description: Subnet ID of the public subnets.
    82      Value:
    83        !Join ["", [!Ref PublicSubnet]]
    84  
    85    PrivateSubnetId:
    86      Description: Subnet ID of the private subnets.
    87      Value:
    88        !Join ["", [!Ref PrivateSubnet]]