forked from aws-cloudformation/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions_cidr.yaml
58 lines (58 loc) · 2.01 KB
/
functions_cidr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
AWSTemplateFormatVersion: 2010-09-09
Parameters:
cidrBlock :
Type: String
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])(\/([0-9]|[1-2][0-9]|3[0-2]))$
count:
Type: Number
MinValue: 1
MaxValue: 256
maskSizeForIPv4:
Type: Number
MinValue: 1
MaxValue: 32
maskSizeForIPv6:
Type: Number
MinValue: 1
MaxValue: 128
vpcSubnetPrefix:
Type: String
Default: '10.0'
AllowedPattern: ^(?:[0-9]{1,3}\\.){1}[0-9]{1,3}$
Resources:
Subnet1:
Type: AWS::EC2::Subnet
Properties:
AssignIpv6AddressOnCreation: true
VpcId: !Ref VPC
#Test Ipv4 CidrBlock
CidrBlock: !Select [0, !Cidr [!Ref cidrBlock, !Ref count, !Ref maskSizeForIPv4]]
#Test Ipv6 CidrBlock
Ipv6CidrBlock: !Select [0, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], !Ref count, !Ref maskSizeForIPv6]]
DependsOn: Ipv6VPCCidrBlock
Subnet2:
Type: AWS::EC2::Subnet
Properties:
AssignIpv6AddressOnCreation: true
VpcId: !Ref VPC
#Test Ipv4 CidrBlock
CidrBlock: !Select [1, !Cidr [!Ref cidrBlock, !Ref count, !Ref maskSizeForIPv4]]
#Test Ipv6 CidrBlock
Ipv6CidrBlock: !Select [1, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], !Ref count, !Ref maskSizeForIPv6]]
DependsOn: Ipv6VPCCidrBlock
Subnet3:
Type: AWS::EC2::Subnet
Properties:
AssignIpv6AddressOnCreation: true
VpcId: !Ref VPC
CidrBlock: !Select [1, !Cidr [!Sub "${VPCSubnetPrefix}.48.0/23", !Ref count, !Ref maskSizeForIPv4]]
DependsOn: Ipv6VPCCidrBlock
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Ref cidrBlock
Ipv6VPCCidrBlock:
Type: AWS::EC2::VPCCidrBlock
Properties:
AmazonProvidedIpv6CidrBlock: true
VpcId: !Ref VPC