# Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Description: Attempts to create a VPC and 3 subnets with automatically assigned CIDR ranged. It fails because the VPC is not large enough to house the subnets. Resources: Vpc: Type: AWS::EC2::VPC Properties: CidrBlock: 10.0.0.0/24 # Call the custom resource, specify 3 subnets of different sizes. # The resource will have a property called CidrBlocks with an array of 3 CIDR block definitions CidrFindr: Type: Custom::CidrFindr Properties: ServiceToken: !ImportValue CidrFindr VpcId: !Ref Vpc Sizes: [25, 26, 25] # Bigger than we can accomodate Subnet1: Type: AWS::EC2::Subnet Properties: VpcId: !Ref Vpc CidrBlock: !GetAtt CidrFindr.CidrBlock1 Subnet2: Type: AWS::EC2::Subnet Properties: VpcId: !Ref Vpc CidrBlock: !GetAtt CidrFindr.CidrBlock2 Subnet3: Type: AWS::EC2::Subnet Properties: VpcId: !Ref Vpc CidrBlock: !GetAtt CidrFindr.CidrBlock3