aws-must-templates 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +97 -44
  3. data/lib/tasks/cross-ref.rb +6 -0
  4. data/lib/tasks/suite.rake +150 -48
  5. data/lib/test-suites/test_suites.rb +13 -13
  6. data/mustache/commonDependsOn.mustache +24 -2
  7. data/mustache/commonRef.mustache +22 -0
  8. data/mustache/commonValue.mustache +1 -1
  9. data/mustache/commonXGressRule.mustache +31 -0
  10. data/mustache/mapping.mustache +3 -1
  11. data/mustache/mappingAmazonVpcNat.mustache +38 -0
  12. data/mustache/resource.mustache +4 -0
  13. data/mustache/resourceInstance.mustache +26 -7
  14. data/mustache/resourceInternetGateway.mustache +30 -16
  15. data/mustache/resourceRoute.mustache +50 -0
  16. data/mustache/resourceRouteTable.mustache +67 -0
  17. data/mustache/resourceSecurityGroup.mustache +13 -12
  18. data/mustache/resourceSubnet.mustache +20 -8
  19. data/mustache/root.mustache +26 -11
  20. data/spec/aws-must-templates/AllwaysOk/AllwaysOk_spec.rb +35 -0
  21. data/spec/aws-must-templates/AwsCommandLineInterfaceInstalled/AwsCommandLineInterfaceInstalled_spec.rb +19 -1
  22. data/spec/aws-must-templates/AwsMustTestRunnerProperties/AwsMustTestRunnerProperties_spec.rb +16 -1
  23. data/spec/aws-must-templates/CloudFormationHelperScriptsInstalled/CloudFormationHelperScriptsInstalled_spec.rb +17 -0
  24. data/spec/aws-must-templates/Ec2InstanceType/Ec2InstanceType_spec.rb +47 -0
  25. data/spec/aws-must-templates/Ec2PrivateIp/Ec2PrivateIp_spec.rb +49 -0
  26. data/spec/aws-must-templates/Ec2PublicIp/Ec2PublicIp_spec.rb +68 -0
  27. data/spec/aws-must-templates/Ec2Routes/Ec2Routes_spec.rb +69 -0
  28. data/spec/aws-must-templates/Ec2SecurityGroups/Ec2SecurityGroups_spec.rb +151 -0
  29. data/spec/aws-must-templates/Ec2StatusNormal/Ec2StatusNormal_spec.rb +55 -0
  30. data/spec/aws-must-templates/NetworkCanPing/NetworkCanPing_spec.rb +36 -0
  31. data/spec/aws-must-templates/ParameterTest/ParameterTest_spec.rb +17 -1
  32. data/spec/aws-must-templates/RespondsToPing/RespondsToPing_spec.rb +46 -0
  33. data/spec/aws-must-templates/S3NoAccess/S3NoAccess_spec.rb +17 -3
  34. data/spec/aws-must-templates/S3ReadAccessAllowed/S3ReadAccessAllowed_spec.rb +18 -1
  35. data/spec/aws-must-templates/Stack/Stack_spec.rb +28 -1
  36. data/spec/aws-must-templates/ValidOSVersion/ValidOSVersion_spec.rb +16 -1
  37. data/spec/aws-must-templates/Vpc/vpc_spec.rb +51 -0
  38. data/spec/aws-must-templates/table_of_content.mustache +67 -0
  39. data/spec/lib/test_suites_spec.rb +101 -28
  40. data/spec/mustache/commonDependsOn_spec.rb +57 -2
  41. data/spec/mustache/commonInstanceType_spec.rb +1 -1
  42. data/spec/mustache/mappingAmazonVpcNat_spec.rb +56 -0
  43. data/spec/mustache/mapping_spec.rb +48 -7
  44. data/spec/mustache/resourceInstance_spec.rb +102 -1
  45. data/spec/mustache/resourceInternetGateway_spec.rb +14 -9
  46. data/spec/mustache/resourcePolicy_spec.rb +1 -1
  47. data/spec/mustache/resourceS3Bucket_spec.rb +1 -1
  48. data/spec/mustache/resourceSecurityGroup_spec.rb +3 -3
  49. data/spec/mustache/resourceSubnet_spec.rb +50 -3
  50. data/spec/support/lib/aws/aws.rb +6 -0
  51. data/spec/support/lib/aws/ec2_resource.rb +177 -0
  52. data/spec/support/lib/aws/mixin_cidr.rb +18 -0
  53. data/spec/support/lib/aws/mixin_ec2.rb +53 -0
  54. data/spec/support/lib/aws/mixin_security_group.rb +15 -0
  55. data/spec/support/lib/aws/mixin_subnet.rb +77 -0
  56. data/spec/support/lib/aws/mixin_vpc.rb +10 -0
  57. data/spec/support/lib/aws/route_resource.rb +86 -0
  58. data/spec/support/lib/aws/security_group_resource.rb +120 -0
  59. data/spec/support/lib/aws/vpc_resource.rb +69 -0
  60. data/spec/support/lib/suite_value.rb +38 -0
  61. data/spec/support/lib/test_parameter.rb +12 -8
  62. data/spec/support/lib/valid_property.rb +29 -9
  63. data/spec/support/spec_helper.rb +75 -44
  64. data/spec/support/utils.rb +4 -0
  65. metadata +34 -24
@@ -10,7 +10,19 @@ Common template to output key and value for `DependsOn`
10
10
 
11
11
  **Attributes**:
12
12
 
13
- * `DependsOn` : resource name on which dependency defined
13
+ * `DependsOn` : resource name/array on which dependency defined
14
+
15
+ Example depends on `resource1`
16
+
17
+ DependsOn: resource1
18
+
19
+
20
+ Example depends on `resource1`, `resource2`
21
+
22
+ DependsOn:
23
+ - resource1
24
+ - resource2
25
+
14
26
 
15
27
  +++close+++
16
28
 
@@ -18,8 +30,18 @@ Common template to output key and value for `DependsOn`
18
30
 
19
31
  {{! +++fold-on+++ }}
20
32
 
33
+ {{! Array context define 'any?' }}
34
+ {{# DependsOn.any? }}
35
+ , "DependsOn" : {{{DependsOn}}}
36
+ {{/ DependsOn.any? }}
37
+
21
38
 
22
- {{# DependsOn }}, "DependsOn" : "{{DependsOn}}" {{/ DependsOn }}
39
+ {{! String does not define 'any?' }}
40
+ {{^ DependsOn.any? }}
41
+ {{# DependsOn }}
42
+ , "DependsOn" : "{{{DependsOn}}}"
43
+ {{/ DependsOn }}
44
+ {{/ DependsOn.any? }}
23
45
 
24
46
 
25
47
  {{! +++fold-off+++ }}
@@ -0,0 +1,22 @@
1
+ {{!
2
+
3
+
4
+ +++start+++
5
+
6
+ ## <a id="commonRef.mustache"></a>commonRef.mustache<a class='navigator' href='#top'>[top]</a>
7
+
8
+ Common template to output reference (in context)
9
+
10
+ **Attributes**:
11
+
12
+ * `.`: referenece in context
13
+
14
+ +++close+++
15
+
16
+ }}
17
+
18
+ {{! +++fold-on+++ }}
19
+
20
+ { "Ref": "{{.}}" }
21
+
22
+ {{! +++fold-off+++ }}
@@ -26,7 +26,7 @@ Common template to output value (Value/Ref/Attr/StackRef)
26
26
 
27
27
 
28
28
  {{#Value}}"{{Value}}"{{/Value}}
29
- {{#Ref}}{ "Ref": "{{Ref}}" }{{/Ref}}
29
+ {{#Ref}} {{> commonRef }} {{/Ref}}
30
30
  {{#Attr}}{ "Fn::GetAtt" : [ "{{Ref}}", "{{Name}}" ] }{{/Attr}}
31
31
  {{#StackRef}}{ "Fn::GetAtt": [ "{{Stack}}", "Outputs.{{Output}}"] }{{/StackRef}}
32
32
 
@@ -0,0 +1,31 @@
1
+ {{!
2
+
3
+
4
+ +++start+++
5
+
6
+ ## <a id="commonXGressRule.mustache"></a>commonXGressRule.mustache<a class='navigator' href='#top'>[top]</a>
7
+
8
+ Common template to output SecurityGroupIngress or SecurityGroupEgress rules.
9
+
10
+ **Attributes**:
11
+
12
+ * `IpProtocol`: default tcp
13
+ * `FromPort`: default to `Port`
14
+ * `ToPort`: defaults to `Port`
15
+ * CidrIp given as commonValue, [commonValue.mustache](#commonValue.mustache)
16
+
17
+ +++close+++
18
+
19
+ }}
20
+
21
+ {{! +++fold-on+++ }}
22
+
23
+ {
24
+ "IpProtocol" : {{#IpProtocol}}"{{IpProtocol}}"{{/IpProtocol}}{{^IpProtocol}}"tcp"{{/IpProtocol}},
25
+ "FromPort" : "{{#FromPort}}{{FromPort}}{{/FromPort}}{{^FromPort}}{{Port}}{{/FromPort}}",
26
+ "ToPort" : "{{#ToPort}}{{ToPort}}{{/ToPort}}{{^ToPort}}{{Port}}{{/ToPort}}",
27
+ "CidrIp" : {{> commonValue }}
28
+ }
29
+
30
+
31
+ {{! +++fold-off+++ }}
@@ -11,7 +11,8 @@ Dispatches mapping sub-type templates based mapping Type propertys
11
11
 
12
12
  **Attributes**: context= `./mappings`
13
13
 
14
- * `SubnetConfig`:
14
+ * `SubnetConfig`: output [mappingSubnetConfig.mustache](#mappingSubnetConfig.mustache)
15
+ * `AmazonVpcNat`: output [mappingAmazonVpcNat.mustache](#mappingAmazonVpcNat.mustache)
15
16
 
16
17
  +++close+++
17
18
 
@@ -22,6 +23,7 @@ Dispatches mapping sub-type templates based mapping Type propertys
22
23
  {{! +++fold-on+++ }}
23
24
 
24
25
  {{# SubnetConfig }}{{> mappingSubnetConfig }}{{/ SubnetConfig }}
26
+ {{# AmazonVpcNat }}{{> mappingAmazonVpcNat }}{{/ AmazonVpcNat }}
25
27
 
26
28
 
27
29
  {{! +++fold-off+++ }}
@@ -0,0 +1,38 @@
1
+ {{!
2
+
3
+ +++start+++
4
+
5
+ ## <a id="mappings.mustache"></a>mappings.mustache <a class='navigator' href='#top'>[top]</a>
6
+
7
+ Mapping table `region-->ami` with `root-device=ebs`,
8
+ `architecture,Values=x86_64`, and `--owners amazon`
9
+
10
+
11
+ +++close+++
12
+
13
+
14
+ ==================================================================
15
+ The template
16
+ ==================================================================
17
+
18
+ }}
19
+
20
+
21
+ {{! +++fold-on+++ }}
22
+
23
+
24
+
25
+ "{{Name}}" : {
26
+ "us-east-1" : { "AMI" : "ami-184dc970" },
27
+ "us-west-1" : { "AMI" : "ami-a98396ec" },
28
+ "us-west-2" : { "AMI" : "ami-290f4119" },
29
+ "eu-west-1" : { "AMI" : "ami-14913f63" },
30
+ "eu-central-1" : { "AMI" : "ami-ae380eb3" },
31
+ "sa-east-1" : { "AMI" : "ami-8122969c" },
32
+ "ap-southeast-1" : { "AMI" : "ami-6aa38238" },
33
+ "ap-southeast-2" : { "AMI" : "ami-893f53b3" },
34
+ "ap-northeast-1" : { "AMI" : "ami-27d6e626" }
35
+ }{{_comma}}
36
+
37
+
38
+ {{! +++fold-off+++ }}
@@ -23,6 +23,8 @@ Dispatches resource sub-type templates based resource Type propertys
23
23
  * `InternetGateway`:
24
24
  * `Subnet`:
25
25
  * `User`: creates [User](#resourceUser.mustache)
26
+ * `RouteTable`: creates [resourceRouteTable.mustache](#resourceRouteTable.mustache)
27
+ * `Route`: creates [resourceRoute.mustache](#resourceRoute.mustache)
26
28
 
27
29
 
28
30
  +++close+++
@@ -45,6 +47,8 @@ Dispatches resource sub-type templates based resource Type propertys
45
47
  {{# Subnet }}{{> resourceSubnet }}{{/ Subnet }}
46
48
  {{# InternetGateway }}{{> resourceInternetGateway }}{{/ InternetGateway }}
47
49
  {{# User }}{{> resourceUser }}{{/ User }}
50
+ {{# RouteTable }}{{> resourceRouteTable }}{{/ RouteTable }}
51
+ {{# Route }}{{> resourceRoute }}{{/ Route }}
48
52
 
49
53
 
50
54
 
@@ -14,8 +14,16 @@ Create an EC2 instance
14
14
  * Instance type (mandatory)
15
15
  * `InstanceType` : The instance type, such as t2.micro.
16
16
  * `InstanceTyperef` : Reference to instance type
17
- * `tags` : array of tag sub-documents for EC2 instance
17
+ * `MapRegionToImageId` : alternative name of map for mapping region to
18
+ AMI => imageid, if not defined use default [mappings.mustache](#mappings.mustache)
19
+ * `Tags` : { "Key": "Name", "Name": ``} + array of tag Key- value subdocuments
20
+ * `DependsOn`: see [commonDependsOn.mustache](#commonDependsOn.mustache)
18
21
  * `SecurityGroupIds`: array of [commonValue.mustache](#commonValue.mustache)
22
+ * `SourceDestCheck`: String, (defaults: "true") Controls whether
23
+ source/destination checking is enabled on the instance. Also
24
+ determines if an instance in a VPC will perform network address
25
+ translation (NAT). For the instance to perform NAT, the value must
26
+ be "false".
19
27
 
20
28
 
21
29
  +++close+++
@@ -27,15 +35,26 @@ Create an EC2 instance
27
35
  "{{Name}}" : {
28
36
  "Type" : "AWS::EC2::Instance"
29
37
  {{> commonCreationPolicy }}
30
- , "Metadata": {
31
- {{> resourceInstanceMetadata }}
38
+ {{> commonDependsOn }}
39
+ , "Metadata": {
40
+ {{> resourceInstanceMetadata }}
32
41
 
33
- } {{! metadata }}
42
+ } {{! metadata }}
34
43
  , "Properties" : {
35
- "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
36
- { "Fn::FindInMap" : [ "AWSInstanceType2Arch", {{> commonInstanceType }}, "Arch" ] } ] }
44
+ "ImageId" :
45
+ {{^ MapRegionToImageId }}
46
+ { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
47
+ { "Fn::FindInMap" : [ "AWSInstanceType2Arch", {{> commonInstanceType }}, "Arch" ] } ] }
48
+ {{/ MapRegionToImageId }}
49
+ {{# MapRegionToImageId }}
50
+ { "Fn::FindInMap" : [ "{{MapRegionToImageId}}", { "Ref" : "AWS::Region" }, "AMI" ] }
51
+ {{/ MapRegionToImageId }}
52
+
37
53
  , "InstanceType" : {{> commonInstanceType}} {{! InstanceType OR InstanceTypeRef }}
38
- , "Tags" : [ {{#tags}}{{>tag}}{{/tags}} ]
54
+ , "Tags" : [ { "Key": "Name", "Value": "{{Name}}" }
55
+ {{# Tags }},{{> commonKeyValue }}{{_comma}}{{/ Tags }}
56
+ ]
57
+ , "SourceDestCheck": {{# SourceDestCheck }}{{SourceDestCheck}}{{/ SourceDestCheck }}{{^ SourceDestCheck }}true{{/ SourceDestCheck }}
39
58
  , "SecurityGroupIds" : [
40
59
  {{# SecurityGroupIds }}
41
60
  {{> commonValue }}{{_comma}}
@@ -14,9 +14,12 @@ access on `Vpc` && `Subnet`
14
14
  **Attributes**: context= `./resources/InstanceSecurityGroup`
15
15
 
16
16
  * `Name` : of the Internet Gateway
17
- * `Vpc`: reference to VPC where to atttace
18
17
  * `Subnet`: reference to VPC where to attach route to InternetGateway
19
18
  * `Tags`: (optional) as [commonKeyValue.mustache](#commonKeyValue.mustache)
19
+ * `Attachment` : sub document defining attachment to vpc
20
+ * `AttachmentName` of the attachment resource
21
+ * `Vpc`: reference to VPC where to atttace
22
+
20
23
 
21
24
 
22
25
  +++close+++
@@ -25,58 +28,69 @@ access on `Vpc` && `Subnet`
25
28
 
26
29
  {{! +++fold-on+++ }}
27
30
 
28
-
29
31
  {{! Create internet gateway }}
30
32
  "{{Name}}" : {
31
33
  "Type" : "AWS::EC2::InternetGateway",
32
34
  "Properties" : {
33
- "Tags" : [ {{# Tags }}{{> commonKeyValue }}{{_comma}}{{/ Tags }}]
35
+ "Tags" : [ { "Key": "Name", "Value": "{{Name}}" }
36
+ {{# Tags }},{{> commonKeyValue }}{{_comma}}{{/ Tags }}
37
+ ]
34
38
  }
35
- },
39
+ }
36
40
 
41
+
42
+ {{# Attachment }}
37
43
  {{! Attache the internet gateway created to VPC }}
38
- "Attach{{Vpc}}" : {
44
+ , "{{AttachmentName}}" : {
39
45
  "Type" : "AWS::EC2::VPCGatewayAttachment",
40
46
  "Properties" : {
41
47
  "VpcId" : { "Ref" : "{{Vpc}}" },
42
- "InternetGatewayId" : { "Ref" : "{{Name}}" }
48
+ {{! reference to internet gateway name }}
49
+ "InternetGatewayId" : {{# .. }} {{# Name }} {{> commonRef }}{{/ Name }}{{/ .. }}
43
50
  }
44
- },
51
+ }
52
+ {{/ Attachment }}
53
+
45
54
 
46
55
 
47
56
  {{! Create a route table for VPC }}
48
57
 
49
- "RouteTable{{Vpc}}" : {
58
+ , "RouteTable{{Name}}" : {
50
59
  "Type" : "AWS::EC2::RouteTable",
51
60
  "Properties" : {
61
+ {{# Attachment }}
52
62
  "VpcId" : { "Ref" : "{{ Vpc }}" },
63
+ {{/ Attachment }}
53
64
  "Tags" : [
54
- {"Key": "Name", "Value" : "RouteTable{{Vpc}}" }
65
+ {"Key": "Name", "Value" : "RouteTable{{Name}}" }
55
66
  , {"Key" : "Application", "Value" : { "Ref" : "AWS::StackId"} }
56
67
  ]
57
68
  }
58
- },
69
+ }
70
+
59
71
 
60
72
 
61
73
  {{! Add a route to internet gateway created }}
62
74
 
63
- "Route{{Vpc}}" : {
75
+ , "Route{{Vpc}}" : {
64
76
  "Type" : "AWS::EC2::Route",
65
- "DependsOn" : "Attach{{Vpc}}",
77
+ {{# Attachment }}
78
+ "DependsOn" : "{{AttachmentName}}",
79
+ {{/ Attachment }}
66
80
  "Properties" : {
67
- "RouteTableId" : { "Ref" : "RouteTable{{Vpc}}" }
81
+ "RouteTableId" : { "Ref" : "RouteTable{{Name}}" }
68
82
  , "DestinationCidrBlock" : "0.0.0.0/0"
69
83
  , "GatewayId" : { "Ref" : "{{Name}}" }
70
84
  }
71
- },
85
+ }
72
86
 
73
87
  {{! Associates a subnet with a route table. }}
74
88
 
75
- "RouteTableAssociation{{Subnet}}" : {
89
+ , "RouteTableAssociation{{Subnet}}" : {
76
90
  "Type" : "AWS::EC2::SubnetRouteTableAssociation"
77
91
  , "Properties" : {
78
92
  "SubnetId" : { "Ref" : "{{Subnet}}" }
79
- , "RouteTableId" : { "Ref" : "RouteTable{{Vpc}}" }
93
+ , "RouteTableId" : { "Ref" : "RouteTable{{Name}}" }
80
94
  }
81
95
  }
82
96
 
@@ -0,0 +1,50 @@
1
+ {{!
2
+
3
+
4
+ +++start+++
5
+
6
+ ## <a id="resourceRoute.mustache"></a>resourceRoute.mustache <a class='navigator' href='#top'>[top]</a>
7
+
8
+ **Attributes**:
9
+
10
+ * `Name` : of the route -resource
11
+
12
+ * `DependsOn` : [commonDependsOn.mustache](#commonDependsOn.mustache)
13
+
14
+ * `RouteTableId`: The ID of the route table where the route will be
15
+ added, [commonRef.mustache](#commonRef.mustache)
16
+
17
+ * `DestinationCidrBlock`: The CIDR address block used for the
18
+ destination match. For example, "0.0.0.0/0". Routing decisions are
19
+ based on the most specific match.
20
+
21
+ * You must specify only one of the following properties: `GatewayId`,
22
+ `InstanceId`, `NetworkInterfaceId`, or `VpcPeeringConnection`
23
+
24
+ * `GatewayId`: The ID of an Internet gateway or virtual private
25
+ gateway that is attached to your VPC
26
+
27
+ * `InstanceId`: The ID of a NAT instance in your VPC. For example, "i-1a2b3c4d".
28
+
29
+
30
+
31
+ +++close+++
32
+
33
+ }}
34
+
35
+ {{! +++fold-on+++ }}
36
+
37
+ "{{Name}}" : {
38
+ "Type" : "AWS::EC2::Route"
39
+ {{> commonDependsOn }}
40
+ , "Properties" : {
41
+ "RouteTableId" : {{#RouteTableId}}{{> commonRef }}{{/RouteTableId}}
42
+ , "DestinationCidrBlock" : "{{DestinationCidrBlock}}"
43
+ {{! one of }}
44
+ {{#GatewayId}}, "GatewayId" : {{> commonRef }}{{/GatewayId}}
45
+ {{#InstanceId}}, "InstanceId" : {{> commonRef }}{{/InstanceId}}
46
+
47
+ }
48
+ }{{ _comma }}
49
+
50
+ {{! +++fold-off+++ }}
@@ -0,0 +1,67 @@
1
+ {{!
2
+
3
+
4
+ +++start+++
5
+
6
+ ## <a id="resourceRouteTable.mustache"></a>resourceRouteTable.mustache <a class='navigator' href='#top'>[top]</a>
7
+
8
+ A `route table` contains a set of rules, called routes, that are used
9
+ to determine where network traffic is directed. Thi template creates
10
+ a new route table within a VPC. After you create a new route table,
11
+ you can add routes and associate the table with a subnet.
12
+
13
+ The following are the
14
+ [basic things](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html)
15
+ that you need to know about route tables:
16
+
17
+ * Your VPC has an implicit router.
18
+
19
+ * Your VPC automatically comes with a main route table that you can
20
+ modify.
21
+
22
+ * You can create additional custom route tables for your VPC.
23
+
24
+ * Each subnet must be associated with a route table, which controls
25
+ the routing for the subnet. If you don't explicitly associate a
26
+ subnet with a particular route table, the subnet uses the main
27
+ route table.
28
+
29
+ * You can replace the main route table with a custom table that you've
30
+ created (so that this table is the default table each new subnet is
31
+ associated with).
32
+
33
+ * Each route in a table specifies a destination CIDR and a target (for
34
+ example, traffic destined for 172.16.0.0/12 is targeted for the
35
+ virtual private gateway); we use the most specific route that
36
+ matches the traffic to determine how to route the traffic.
37
+
38
+
39
+ **Attributes**:
40
+
41
+ * `Name` : of the route-table
42
+ * `Vpc`: reference to VPC where attached, [commonRef.mustache](#commonRef.mustache)
43
+ * `Subnet`: reference to VPC where to attach route to InternetGateway
44
+ * `DependsOn` : [commonDependsOn.mustache](#commonDependsOn.mustache)
45
+ * `Tags`: (optional) as [commonKeyValue.mustache](#commonKeyValue.mustache)
46
+ * `Routes`: an array of routes processed in []()
47
+
48
+
49
+ +++close+++
50
+
51
+ }}
52
+
53
+ {{! +++fold-on+++ }}
54
+
55
+ "{{Name}}" : {
56
+ "Type" : "AWS::EC2::RouteTable"
57
+ {{> commonDependsOn }}
58
+ , "Properties" : {
59
+ "VpcId" : {{#Vpc}}{{> commonRef }}{{/Vpc}}
60
+ , "Tags" : [
61
+ {"Key": "Name", "Value" : "{{Name}}" }
62
+ {{# Tags }},{{> commonKeyValue }}{{_comma}}{{/ Tags }}
63
+ ]
64
+ }
65
+ }{{ _comma }}
66
+
67
+ {{! +++fold-off+++ }}
@@ -8,15 +8,13 @@
8
8
 
9
9
  Create an EC2 Security Group
10
10
 
11
- **Attributes**: context= `./resources/SecurityGroup`
11
+ **Attributes**:
12
12
 
13
13
  * `Name` : of the security group
14
14
  * `VpcId`: The Reference name physical ID of the VPC. given as commonValue, [commonValue.mustache](#commonValue.mustache)
15
- * `SecurityGroupIngress`: Arrays in a SecurityGroupIngr
16
- * `IpProtocol`: default tcp
17
- * `FromPort`: default to `Port`
18
- * `ToPort`: defaults to `Port`
19
- * CidrIp given as commonValue, [commonValue.mustache](#commonValue.mustache)
15
+ * `SecurityGroupIngress`: create array of ingress rules with [commonXGressRule.mustache](#commonXGressRule.mustache)
16
+ * `SecurityGroupEgress`: create array of ingress rules with [commonXGressRule.mustache](#commonXGressRule.mustache) template
17
+ * `Tags` : { "Key": "Name", "Name": ``} + array of tag Key- value subdocuments
20
18
 
21
19
 
22
20
  +++close+++
@@ -30,14 +28,17 @@ Create an EC2 Security Group
30
28
  "Properties" : {
31
29
  "GroupDescription" : "Enable SSH access via port 22"
32
30
  {{# VpcId }}, "VpcId": {{> commonValue }} {{/ VpcId }}
31
+ , "Tags" : [ { "Key": "Name", "Value": "{{Name}}" }
32
+ {{# Tags }},{{> commonKeyValue }}{{_comma}}{{/ Tags }}
33
+ ]
34
+ , "SecurityGroupEgress" : [
35
+ {{# SecurityGroupEgress }}
36
+ {{> commonXGressRule }}{{_comma}}
37
+ {{/ SecurityGroupEgress }}
38
+ ]
33
39
  , "SecurityGroupIngress" : [
34
40
  {{# SecurityGroupIngress }}
35
- {
36
- "IpProtocol" : {{#IpProtocol}}"{{IpProtocol}}"{{/IpProtocol}}{{^IpProtocol}}"tcp"{{/IpProtocol}},
37
- "FromPort" : "{{#FromPort}}{{FromPort}}{{/FromPort}}{{^FromPort}}{{Port}}{{/FromPort}}",
38
- "ToPort" : "{{#ToPort}}{{ToPort}}{{/ToPort}}{{^ToPort}}{{Port}}{{/ToPort}}",
39
- "CidrIp" : {{> commonValue }}
40
- } {{_comma}}
41
+ {{> commonXGressRule }}{{_comma}}
41
42
  {{/ SecurityGroupIngress }}
42
43
  ]
43
44
  }
@@ -11,12 +11,13 @@ Creates a subnet in an existing VPC.
11
11
  **Attributes**:
12
12
 
13
13
  * `Name` : of the VPC resource
14
- * `CidrBlock` or as [commonKeyValue.mustache](#commonKeyValue.mustache)
15
- * `VpcId`: resource name of VPC
16
- * `MapPublicIpOnLaunch`: Indicates whether instances that are
17
- launched in this subnet receive a public IP address. By default,
18
- the value is `false`.
19
- * `Tags`: (optional) as [commonKeyValue.mustache](#commonKeyValue.mustache)
14
+ * `CidrBlock` or as [commonKeyValue.mustache](#commonKeyValue.mustache)
15
+ * `VpcId`: resource name of VPC
16
+ * `MapPublicIpOnLaunch`: Indicates whether instances that are
17
+ launched in this subnet receive a public IP address. By default,
18
+ the value is `false`.
19
+ * `Tags`: (optional) as [commonKeyValue.mustache](#commonKeyValue.mustache)
20
+ * `RoutetableAssociation`: Associates a subnet with a route table.
20
21
 
21
22
 
22
23
  +++close+++
@@ -33,9 +34,20 @@ Creates a subnet in an existing VPC.
33
34
  "CidrBlock" : "{{CidrBlock}}"
34
35
  , "Tags" : [ {{# Tags }}{{> commonKeyValue }}{{_comma}}{{/ Tags }}]
35
36
  , "MapPublicIpOnLaunch" : {{^MapPublicIpOnLaunch}}false{{/ MapPublicIpOnLaunch}}{{# MapPublicIpOnLaunch}}{{MapPublicIpOnLaunch}}{{/ MapPublicIpOnLaunch}}
36
- , "VpcId" : { "Ref" : "{{VpcId}}" }
37
+ , "VpcId" : {{#VpcId}} {{> commonRef }} {{/VpcId}}
37
38
  }
38
- }{{_comma}}
39
+ }
40
+
41
+ {{# RoutetableAssociation }}
42
+ , "{{Name}}RouteTableAssociation" : {
43
+ "Type" : "AWS::EC2::SubnetRouteTableAssociation",
44
+ "Properties" : {
45
+ "RouteTableId" : {{> commonRef }}
46
+ , "SubnetId" : {{# ..}}{{# Name}}{{> commonRef }}{{/ Name }}{{/ .. }}
47
+ }
48
+ }
39
49
 
50
+ {{/ RoutetableAssociation }}
51
+ {{_comma}}
40
52
 
41
53
  {{! +++fold-off+++ }}
@@ -64,10 +64,18 @@ Templates for `aws-must` tool.
64
64
  <li><a href="#root.mustache">root.mustache</a>: root template = starting point of template rendering</li>
65
65
 
66
66
  <li><a href="#parameter.mustache">parameter.mustache</a>: create one parameter entry to CloudFormation JSON parameter section</li>
67
+
68
+ <ul>
67
69
 
68
- <li><a href="#mappings.mustache">mappings.mustache</a>: matches a key to a corresponding set of named values</li>
70
+ <li><a href="#mappings.mustache">mappings.mustache</a>: matches a key to a corresponding set of named values</li>
69
71
 
70
- <li><a href="#mappingSubnetConfig.mustache">mappingSubnetConfig.mustache</a>: subnet config mapping to map VPC/Public/Private key to CIDR subnet block.</li>
72
+ <li><a href="#mappingSubnetConfig.mustache">mappingSubnetConfig.mustache</a>: subnet config mapping to map VPC/Public/Private key to CIDR subnet block.</li>
73
+
74
+ <li><a href="#mappingSubnetConfig.mustache">mappingSubnetConfig.mustache</a>: subnet config mapping to map VPC/Public/Private key to CIDR subnet block.</li>
75
+
76
+ <li><a href="#mappingAmazonVpcNat.mustache">mappingAmazonVpcNat.mustache</a>: mapping for vpc-nat instances</li>
77
+
78
+ </ ul>
71
79
 
72
80
  <li><a href="#resource.mustache">resource.mustache</a>: dispatch resource based on resource type</li>
73
81
 
@@ -121,20 +129,24 @@ Templates for `aws-must` tool.
121
129
 
122
130
  <ul>
123
131
 
124
- <li><a href="#commonInstanceType.mustache">commonInstanceType.mustache</a>: Output value for `InstanceType` -attribute</li>
125
-
126
- <li><a href="#commonValue.mustache">commonValue.mustache</a>: Common template to output value (Value/Ref/Attr/StackRef)</li>
132
+ <li> <a href="#commonCfnSignal.mustache">commonCfnSignal.mustache</a>: </li>
127
133
 
128
- <li><a href="#commonKeyValue.mustache">commonKeyValue.mustache</a>: Common template output key value pairs</li>
134
+ <li> <a href="#commonCreationPolicy.mustache">commonCreationPolicy.mustache</a>: </li>
129
135
 
130
136
  <li> <a href="#commonDependsOn.mustache">commonDependsOn.mustache</a>: </li>
131
137
 
132
- <li> <a href="#commonCreationPolicy.mustache">commonCreationPolicy.mustache</a>: </li>
138
+ <li><a href="#commonInstanceType.mustache">commonInstanceType.mustache</a>: Output value for `InstanceType` -attribute</li>
133
139
 
134
- <li> <a href="#commonCfnSignal.mustache">commonCfnSignal.mustache</a>: </li>
140
+ <li><a href="#commonKeyValue.mustache">commonKeyValue.mustache</a>: Common template output key value pairs</li>
141
+
142
+ <li> <a href="#commonRef.mustache">commonRef.mustache</a>: reference</li>
135
143
 
136
144
  <li> <a href="#commonStackRef.mustache">commonStackRef.mustache</a>: </li>
137
145
 
146
+ <li><a href="#commonValue.mustache">commonValue.mustache</a>: Common template to output value (Value/Ref/Attr/StackRef)</li>
147
+
148
+ <li> <a href="#commonXGressRule.mustache">commonXGressRule.mustache</a>: SecurityGroupIngress/SecurityGroupEgress rules</li>
149
+
138
150
  </ul>
139
151
 
140
152
  </ul>
@@ -202,6 +214,7 @@ INCLUDED templates
202
214
  > mappings
203
215
  > mapping
204
216
  > mappingSubnetConfig
217
+ > mappingAmazonVpcNat
205
218
 
206
219
  > resources
207
220
  > resource
@@ -229,13 +242,15 @@ INCLUDED templates
229
242
 
230
243
  > output
231
244
 
245
+ > commonCfnSignal
246
+ > commonCreationPolicy
232
247
  > commonDependsOn
233
248
  > commonInstanceType
234
- > commonCreationPolicy
235
- > commonCfnSignal
236
- > commonValue
237
249
  > commonKeyValue
250
+ > commonRef
238
251
  > commonStackRef
252
+ > commonValue
253
+ > commonXGressRule
239
254
 
240
255
  +++close+++
241
256
 
@@ -0,0 +1,35 @@
1
+ =begin
2
+
3
+ +++start+++
4
+
5
+ ## <a id="AllwaysOk"></a>AllwaysOk<a class='navigator' href='#top'>[top]</a>
6
+
7
+ Make at least one test succeed.
8
+
9
+ +++close+++
10
+
11
+ =end
12
+
13
+ # +++fold-on+++
14
+
15
+ require 'spec_helper'
16
+
17
+
18
+ current_test = File.basename File.dirname __FILE__
19
+
20
+ describe current_test do
21
+
22
+
23
+ # ------------------------------------------------------------------
24
+ # Test paramters defined
25
+
26
+ describe "Success" do
27
+
28
+ it "#works" do
29
+ expect( 1 ).to eql( 1 )
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+ # +++fold-off+++