aws-must 0.0.2

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 (48) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +235 -0
  3. data/bin/aws-must.rb +92 -0
  4. data/demo/0/conf.yaml +1 -0
  5. data/demo/0/root.mustache +1 -0
  6. data/demo/1/conf.yaml +1 -0
  7. data/demo/1/root.mustache +22 -0
  8. data/demo/2/conf.yaml +6 -0
  9. data/demo/2/root.mustache +54 -0
  10. data/demo/3/conf.yaml +3 -0
  11. data/demo/3/resources.mustache +26 -0
  12. data/demo/3/root.mustache +85 -0
  13. data/demo/4/conf.yaml +22 -0
  14. data/demo/4/resource.mustache +27 -0
  15. data/demo/4/resourceInstance.mustache +32 -0
  16. data/demo/4/resources.mustache +25 -0
  17. data/demo/4/root.mustache +95 -0
  18. data/demo/5/conf.yaml +32 -0
  19. data/demo/5/output.mustache +39 -0
  20. data/demo/5/resource.mustache +26 -0
  21. data/demo/5/resourceInstance.mustache +35 -0
  22. data/demo/5/resources.mustache +25 -0
  23. data/demo/5/root.mustache +100 -0
  24. data/demo/6/conf.yaml +31 -0
  25. data/demo/6/mappings.mustache +67 -0
  26. data/demo/6/output.mustache +40 -0
  27. data/demo/6/resource.mustache +29 -0
  28. data/demo/6/resourceInstance.mustache +35 -0
  29. data/demo/6/resources.mustache +35 -0
  30. data/demo/6/root.mustache +133 -0
  31. data/demo/7/conf.yaml +54 -0
  32. data/demo/7/mappings.mustache +67 -0
  33. data/demo/7/output.mustache +40 -0
  34. data/demo/7/parameter.mustache +38 -0
  35. data/demo/7/resource.mustache +38 -0
  36. data/demo/7/resourceInstance.mustache +45 -0
  37. data/demo/7/resourceSecurityGroup.mustache +37 -0
  38. data/demo/7/resources.mustache +35 -0
  39. data/demo/7/root.mustache +157 -0
  40. data/demo/7/tag.mustache +30 -0
  41. data/lib/aws-must/aws-must.rb +96 -0
  42. data/lib/aws-must/docu.rb +164 -0
  43. data/lib/aws-must/template.rb +81 -0
  44. data/lib/aws-must.rb +11 -0
  45. data/lib/tasks/demo.rake +139 -0
  46. data/lib/utils/hasher.rb +83 -0
  47. data/lib/utils/logger.rb +71 -0
  48. metadata +106 -0
@@ -0,0 +1,95 @@
1
+ {{!
2
+
3
+ root.mustache: root level template,
4
+
5
+ ==================================================================
6
+ STYLE section
7
+ ==================================================================
8
+
9
+ ++start++
10
+
11
+ <style>
12
+ h1 {
13
+ color:blue;
14
+ font-size: 2.5em;
15
+ }
16
+ h2 {
17
+ color:blue;
18
+ font-size: 1.5em;
19
+ }
20
+ h3 {
21
+ color:blue;
22
+ font-size: 1.5em;
23
+ }
24
+ body {
25
+ background-color: #b0c4de;
26
+ }
27
+ </style>
28
+
29
+ ++close++
30
+
31
+
32
+ ==================================================================
33
+ CONTENT section
34
+ ==================================================================
35
+
36
+ ++start++
37
+
38
+ # <a id="top">aws-must demo 4 templates</a>
39
+
40
+ This document is generated automically from `aws-must` -demo
41
+ templates.
42
+
43
+
44
+ Output contains markdown syntax between
45
+ **&plus;&plus;start&plus;&plus;** and
46
+ **&plus;&plus;close&plus;&plus;** -tags from the template files. For
47
+ each template, it
48
+
49
+ * gives a general description of the template
50
+
51
+ * documents the attribute context e.g. `.` or `./resources/Instance`,
52
+ and attributes references of the template
53
+
54
+ * lists template actions, i.e. output from template, or template
55
+ inclusion
56
+
57
+ ## <a id="root.mustache"></a>root.mustache <a class='navigator' href='#top'">[top]</a>
58
+
59
+
60
+ Root template
61
+
62
+
63
+ **Attributes**: context= `.`
64
+
65
+ * `description`: description for the CF template
66
+
67
+
68
+ **Actions**:
69
+
70
+ * **Description**: `description`
71
+ * **include** <a href="#resources.mustache">resources.mustache</a>
72
+ * **for** `resource` **in** `resource` **include** <a href="#resource.mustache">resource.mustache</a>
73
+
74
+ > resources
75
+ > resource
76
+
77
+ ++close++
78
+
79
+ }}
80
+
81
+ {
82
+ "AWSTemplateFormatVersion" : "2010-09-09",
83
+
84
+ "Description" : "{{description}}",
85
+
86
+
87
+
88
+ "Resources" : {
89
+
90
+ {{> resources }}
91
+ {{# resources }}{{> resource }}{{/ resources }}
92
+
93
+ }
94
+
95
+ }
data/demo/5/conf.yaml ADDED
@@ -0,0 +1,32 @@
1
+ -- demo/2 : added description property
2
+
3
+
4
+ description: "demo/5: A simple Amazon EC2 instance created using aws-must tool
5
+ - Minimum Viable Solution to Manage CloudFormation
6
+ Templates. This version adds Output section with references
7
+ to InstanceId and PublicId of the newly created EC2 instance'."
8
+
9
+
10
+ parameters:
11
+
12
+ - Name: InstanceType
13
+ Type: String
14
+ Description: EC2 reousrce instance type
15
+ Value: &Param_InstanceType t2.micro
16
+
17
+
18
+ resources:
19
+
20
+ - Instance:
21
+ Name: &Resource_1 MyEC2Instance
22
+ ImageId: ami-00dae61d
23
+ InstanceType: *Param_InstanceType
24
+
25
+
26
+ outputs:
27
+
28
+ - Name: InstanceId1
29
+ Description: InstanceId of the newly created EC2 instance
30
+ Ref: *Resource_1
31
+
32
+
@@ -0,0 +1,39 @@
1
+ {{!
2
+
3
+
4
+ ++start++
5
+
6
+ ## <a id="output.mustache"></a>output.mustache <a class='navigator' href='#top'">[top]</a>
7
+
8
+
9
+ Create one output entry to CloudFormation JSON output section
10
+
11
+ **Attributes**: context= `./outputs`
12
+
13
+ * `Name` : of the ouput entry
14
+ * `Description`: of the output entry
15
+ * `Ref`: name of refernece
16
+ * `Attr`
17
+ * `Ref`: name of attribute reference
18
+ * `Name`: name of the attribute
19
+
20
+
21
+
22
+ **Actions**:
23
+
24
+ * **Name**: `Name`
25
+ * **Description**: `Description`
26
+ * **Value**: **Ref** if `Ref`
27
+ * **Value**: `Attr.Ref`, `Attr.Name` if `Attr`
28
+
29
+ ++close++
30
+
31
+ }}
32
+
33
+
34
+ "{{Name}}": {
35
+ "Description" : "{{Description}}"
36
+ {{#Ref}}, "Value" : { "Ref" : "{{Ref}}" }{{/Ref}}
37
+ {{#Attr}}, "Value" : { "Fn::GetAtt" : [ "{{Ref}}", "{{Name}}" ] }{{/Attr}}
38
+ }{{_comma}}
39
+
@@ -0,0 +1,26 @@
1
+ {{!
2
+
3
+ resource.mustache
4
+
5
+ ++start++
6
+
7
+ ## <a id="resource.mustache"></a>resource.mustache <a class='navigator' href='#top'">[top]</a>
8
+
9
+ Dispatches resource sub-type templates based resource Type propertys
10
+
11
+ **Attributes**: context= `./resources`
12
+
13
+ * `Instance`: sub-document defining an EC instance
14
+
15
+ **Actions**:
16
+
17
+ * include <a href="#resourceInstance.mustache">resourceInstance.mustache</a> if `Instance`
18
+
19
+ > resourceInstance
20
+
21
+ ++close++
22
+
23
+
24
+ }}
25
+
26
+ {{# Instance }}{{> resourceInstance}}{{/ Instance }}
@@ -0,0 +1,35 @@
1
+ {{!
2
+
3
+
4
+ ++start++
5
+
6
+
7
+
8
+ ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'">[top]</a>
9
+
10
+ Create an EC2 instance
11
+
12
+ **Attributes**: context= `./resources/Instance`
13
+
14
+ * `Name`: name of the EC2 instance to create
15
+ * `InstanceType` : The instance type, such as t2.micro.
16
+
17
+ **Actions**:
18
+
19
+
20
+ * **Name**: `Name`
21
+ * **Type**: 'AWS::EC2::Instance'
22
+ * **ImageId**: `ImageId`
23
+
24
+ ++close++
25
+
26
+ }}
27
+
28
+
29
+ "{{Name}}" : {
30
+ "Type" : "AWS::EC2::Instance",
31
+ "Properties" : {
32
+ "ImageId" : "{{ImageId}}",
33
+ "InstanceType" : "{{InstanceType}}"
34
+ } {{! Propertites }}
35
+ }{{_comma}}
@@ -0,0 +1,25 @@
1
+ {{!
2
+
3
+ ++start++
4
+
5
+ ## resources.mustache
6
+
7
+ Nothing created here
8
+
9
+ ++close++
10
+
11
+
12
+ }}
13
+ {{!
14
+
15
+ Moved to YAML
16
+
17
+ "MyEC2Instance" : {
18
+ "Type" : "AWS::EC2::Instance",
19
+ "Properties" : {
20
+ "ImageId" : "ami-00dae61d",
21
+ "InstanceType" : "t2.micro"
22
+ }
23
+ }
24
+
25
+ }}
@@ -0,0 +1,100 @@
1
+ {{!
2
+
3
+ root.mustache: root level template,
4
+
5
+ ==================================================================
6
+ STYLE section
7
+ ==================================================================
8
+
9
+ ++start++
10
+
11
+ <style>
12
+ h1 {
13
+ color:blue;
14
+ font-size: 2.5em;
15
+ }
16
+ h2 {
17
+ color:blue;
18
+ font-size: 1.5em;
19
+ }
20
+ h3 {
21
+ color:blue;
22
+ font-size: 1.5em;
23
+ }
24
+ body {
25
+ background-color: #b0c4de;
26
+ }
27
+ </style>
28
+
29
+ ++close++
30
+
31
+
32
+ ==================================================================
33
+ CONTENT section
34
+ ==================================================================
35
+
36
+ ++start++
37
+
38
+ # <a id="top">aws-must demo 5 templates</a>
39
+
40
+ This document is generated automically from `aws-must` -demo
41
+ templates.
42
+
43
+
44
+ Output contains markdown syntax between
45
+ **&plus;&plus;start&plus;&plus;** and
46
+ **&plus;&plus;close&plus;&plus;** -tags from the template files. For
47
+ each template, it
48
+
49
+ * gives a general description of the template
50
+
51
+ * documents the attribute context e.g. `.` or `./resources/Instance`,
52
+ and attributes references of the template
53
+
54
+ * lists template actions, i.e. output from template, or template
55
+ inclusion
56
+
57
+
58
+ ## <a id="root.mustache"></a>root.mustache <a class='navigator' href='#top'">[top]</a>
59
+
60
+ Starting point of template rendering.
61
+
62
+ **Attributes**: context= `.`
63
+
64
+ * `description`: description for the CF template
65
+
66
+ **Actions**:
67
+
68
+ * **Description**: `description`
69
+ * **include** <a href="#resources.mustache">resources.mustache</a>
70
+ * **for** `resource` **in** `resource` **include** <a href="#resource.mustache">resource.mustache</a>
71
+ * **for** `output` **in** `outputs` **include** <a href="#output.mustache">output.mustache</a>
72
+
73
+
74
+ > resources
75
+ > resource
76
+ > output
77
+
78
+ ++close++
79
+
80
+ }}
81
+
82
+ {
83
+ "AWSTemplateFormatVersion" : "2010-09-09",
84
+
85
+ "Description" : "{{description}}",
86
+
87
+ "Resources" : {
88
+
89
+ {{> resources }}
90
+ {{# resources }}{{> resource }}{{/ resources }}
91
+
92
+ },
93
+
94
+ "Outputs" : {
95
+
96
+ {{# outputs }}{{> output }}{{/ outputs }}
97
+
98
+ }
99
+
100
+ }
data/demo/6/conf.yaml ADDED
@@ -0,0 +1,31 @@
1
+ -- demo/2 : added description property
2
+
3
+
4
+ description: "demo/6 - A simple Amazon EC2 instance created using aws-must tool
5
+ - Minimum Viable Solution to Manage CloudFormation
6
+ Templates. This version uses AWSInstanceType2Arch and AWSRegionArch2AMI
7
+ to define 64bit hmv 't2.micro' instances AMIs for several Amazon regions."
8
+
9
+
10
+ parameters:
11
+
12
+ - Name: InstanceType
13
+ Type: String
14
+ Description: EC2 reousrce instance type
15
+ Value: &Param_InstanceType t2.micro
16
+
17
+
18
+ resources:
19
+
20
+ - Instance:
21
+ Name: &Resource_1 MyEC2Instance
22
+ InstanceType: *Param_InstanceType
23
+
24
+
25
+ outputs:
26
+
27
+ - Name: InstanceId1
28
+ Description: InstanceId of the newly created EC2 instance
29
+ Ref: *Resource_1
30
+
31
+
@@ -0,0 +1,67 @@
1
+ {{!
2
+
3
+ ++start++
4
+
5
+ ## <a id="mappings.mustache"></a>mappings.mustache <a class='navigator' href='#top'">[top]</a>
6
+
7
+
8
+ Create fixed lookup tables `AWSInstanceType2Arch` and
9
+ `AWSRegionArch2AMI` implementing the table below
10
+
11
+ <code><pre>
12
+ ap-northeast-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-90815290 hvm
13
+ ap-southeast-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-0accf458 hvm
14
+ ap-southeast-2 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-1dc8b127 hvm
15
+ cn-north-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-eae27fd3 hvm
16
+ eu-central-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-3248712f hvm
17
+ eu-west-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-d74437a0 hvm
18
+ sa-east-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-0f6ced12 hvm
19
+ us-east-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-83c525e8 hvm
20
+ us-gov-west-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-51513172 hvm
21
+ us-west-1 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-61b25925 hvm
22
+ us-west-2 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami-57e8d767 hvm
23
+ </pre></code>
24
+
25
+
26
+ **Attributes**: context= `.`
27
+
28
+ * none
29
+
30
+
31
+ **Actions**:
32
+
33
+ * **AWSInstanceType2Arch**: fixed key/value mapping, currently only
34
+ **t2.micro** --> **64bit**
35
+
36
+ * **AWSRegionArch2AMI**: fixed key/value mapping created, currently
37
+ architectures only for **64bits**
38
+
39
+
40
+ ++close++
41
+
42
+
43
+ ==================================================================
44
+ The template
45
+ ==================================================================
46
+
47
+ }}
48
+
49
+
50
+
51
+ "AWSInstanceType2Arch" : {
52
+ "t2.micro" : { "Arch" : "64" }
53
+ },
54
+ "AWSRegionArch2AMI" : {
55
+ "ap-northeast-1" : { "64" : "ami-90815290" },
56
+ "ap-southeast-1" : { "64" : "ami-0accf458" },
57
+ "ap-southeast-2" : { "64" : "ami-1dc8b127" },
58
+ "cn-north-1" : { "64" : "ami-eae27fd3" },
59
+ "eu-central-1" : { "64" : "ami-3248712f" },
60
+ "eu-west-1" : { "64" : "ami-d74437a0" },
61
+ "sa-east-1" : { "64" : "ami-0f6ced12" },
62
+ "us-east-1" : { "64" : "ami-83c525e8" },
63
+ "us-west-1" : { "64" : "ami-61b25925" },
64
+ "us-gov-west-1" : { "64" : "ami-51513172" },
65
+ "us-west-2" : { "64" : "ami-57e8d767" }
66
+ }
67
+
@@ -0,0 +1,40 @@
1
+ {{!
2
+
3
+
4
+ ++start++
5
+
6
+ ## <a id="output.mustache"></a>output.mustache <a class='navigator' href='#top'">[top]</a>
7
+
8
+ Create one output entry to CloudFormation JSON output section
9
+
10
+ **Attributes**: context= `./outputs`
11
+
12
+ * `Name` : of the ouput entry
13
+ * `Description`: of the output entry
14
+ * `Ref`: name of refernece
15
+ * `Attr`
16
+ * `Ref`: name of attribute reference
17
+ * `Name`: name of the attribute
18
+
19
+
20
+
21
+ **Actions**:
22
+
23
+ * **Name**: `Name`
24
+ * **Description**: `Description`
25
+ * **Value**: **Ref** if `Ref`
26
+ * **Value**: `Attr.Ref`, `Attr.Name` if `Attr`
27
+
28
+
29
+
30
+ ++close++
31
+
32
+ }}
33
+
34
+
35
+ "{{Name}}": {
36
+ "Description" : "{{Description}}"
37
+ {{#Ref}}, "Value" : { "Ref" : "{{Ref}}" }{{/Ref}}
38
+ {{#Attr}}, "Value" : { "Fn::GetAtt" : [ "{{Ref}}", "{{Name}}" ] }{{/Attr}}
39
+ }{{_comma}}
40
+
@@ -0,0 +1,29 @@
1
+ {{!
2
+
3
+ resource.mustache
4
+
5
+ ++start++
6
+
7
+ ## <a id="resource.mustache"></a>resource.mustache <a class='navigator' href='#top'">[top]</a>
8
+
9
+
10
+ Dispatches resource sub-type templates based resource Type propertys
11
+
12
+ **Attributes**: context= `./resources`
13
+
14
+ * `Instance`: sub-document defining an EC instance
15
+
16
+
17
+ **Actions**:
18
+
19
+ * include <a href="#resourceInstance.mustache">resourceInstance.mustache</a> if `Instance`
20
+
21
+ > resourceInstance
22
+
23
+ ++close++
24
+
25
+
26
+
27
+ }}
28
+
29
+ {{# Instance }}{{> resourceInstance}}{{/ Instance }}
@@ -0,0 +1,35 @@
1
+ {{!
2
+
3
+
4
+ ++start++
5
+
6
+
7
+ ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'">[top]</a>
8
+
9
+ Create an EC2 instance
10
+
11
+ **Attributes**: context= `./resources/Instance`
12
+
13
+ * `Name`: name of the EC2 instance to create
14
+ * `InstanceType` : The instance type, such as t2.micro.
15
+
16
+
17
+ **Actions**:
18
+
19
+ * **Name**: `Name`
20
+ * **Type**: 'AWS::EC2::Instance'
21
+ * **ImageId**: **AWSRegionArch2AMI**( 'AWS::Region', **AWSInstanceType2Arch**(`InstanceType`))
22
+
23
+ ++close++
24
+
25
+ }}
26
+
27
+
28
+ "{{Name}}" : {
29
+ "Type" : "AWS::EC2::Instance",
30
+ "Properties" : {
31
+ "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
32
+ { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "{{InstanceType}}", "Arch" ] } ] },
33
+ "InstanceType" : "{{InstanceType}}"
34
+ } {{! Propertites }}
35
+ }{{_comma}}
@@ -0,0 +1,35 @@
1
+ {{!
2
+
3
+ ++start++
4
+
5
+ ## <a id="resources.mustache"></a>resources.mustache <a class='navigator' href='#top'">[top]</a>
6
+
7
+ Empty template.
8
+
9
+ **Attributes**: context= `.`
10
+
11
+ * none
12
+
13
+
14
+ **Actions**:
15
+
16
+ * no action (i.e. empty template)
17
+
18
+
19
+ ++close++
20
+
21
+
22
+ }}
23
+ {{!
24
+
25
+ Moved to YAML
26
+
27
+ "MyEC2Instance" : {
28
+ "Type" : "AWS::EC2::Instance",
29
+ "Properties" : {
30
+ "ImageId" : "ami-00dae61d",
31
+ "InstanceType" : "t2.micro"
32
+ }
33
+ }
34
+
35
+ }}