aws-must 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/README.md +29 -20
- data/demo/0/root.mustache +13 -1
- data/demo/2/conf.yaml +1 -5
- data/demo/{8 → 2}/resources.mustache +6 -15
- data/demo/2/root.mustache +13 -54
- data/demo/2.old/conf.yaml +5 -0
- data/demo/2.old/root.mustache +85 -0
- data/demo/3/conf.yaml +18 -2
- data/demo/3/resource.mustache +27 -0
- data/demo/3/resourceInstance.mustache +32 -0
- data/demo/3/resources.mustache +9 -8
- data/demo/3/root.mustache +17 -17
- data/demo/4/conf.yaml +19 -14
- data/demo/{8 → 4}/output.mustache +1 -2
- data/demo/4/resource.mustache +1 -1
- data/demo/4/resourceInstance.mustache +10 -5
- data/demo/4/resourceSecurityGroup.mustache +37 -0
- data/demo/4/root.mustache +16 -9
- data/demo/5/conf.yaml +3 -4
- data/demo/{8 → 5}/mappings.mustache +0 -0
- data/demo/5/output.mustache +2 -1
- data/demo/5/resource.mustache +3 -0
- data/demo/5/resourceInstance.mustache +4 -4
- data/demo/5/resources.mustache +12 -2
- data/demo/5/root.mustache +42 -9
- data/demo/6/conf.yaml +27 -8
- data/demo/{8 → 6}/parameter.mustache +0 -0
- data/demo/6/resource.mustache +10 -1
- data/demo/6/resourceInstance.mustache +13 -3
- data/demo/{8 → 6}/resourceSecurityGroup.mustache +0 -0
- data/demo/6/root.mustache +48 -15
- data/demo/{8 → 6}/tag.mustache +0 -0
- data/demo/7/conf.yaml +8 -3
- data/demo/7/resourceInstance.mustache +5 -2
- data/demo/{8 → 7}/resourceInstanceChef.mustache +0 -0
- data/demo/7/root.mustache +11 -3
- data/lib/tasks/demo.rake +6 -7
- metadata +14 -13
- data/demo/8/conf.yaml +0 -61
- data/demo/8/resource.mustache +0 -38
- data/demo/8/resourceInstance.mustache +0 -50
- data/demo/8/root.mustache +0 -191
| @@ -3,6 +3,8 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            ++start++
         | 
| 5 5 |  | 
| 6 | 
            +
             | 
| 7 | 
            +
             | 
| 6 8 | 
             
            ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 7 9 |  | 
| 8 10 | 
             
            Create an EC2 instance
         | 
| @@ -10,13 +12,15 @@ Create an EC2 instance | |
| 10 12 | 
             
            **Attributes**: context=  `./resources/Instance`
         | 
| 11 13 |  | 
| 12 14 | 
             
            * `Name`: name of the EC2 instance to create
         | 
| 13 | 
            -
            * ` | 
| 15 | 
            +
            * `InstanceType` : The instance type, such as t2.micro. 
         | 
| 14 16 |  | 
| 15 17 | 
             
            **Actions**:
         | 
| 16 18 |  | 
| 19 | 
            +
             | 
| 17 20 | 
             
            * **Name**:  `Name`
         | 
| 18 21 | 
             
            * **Type**: 'AWS::EC2::Instance'
         | 
| 19 22 | 
             
            * **ImageId**: `ImageId`
         | 
| 23 | 
            +
            * **SecurityGroups.Ref**: `SecurityGroup` if `SecurityGroup`
         | 
| 20 24 |  | 
| 21 25 | 
             
            ++close++
         | 
| 22 26 |  | 
| @@ -26,7 +30,8 @@ Create an EC2 instance | |
| 26 30 | 
             
                "{{Name}}" : {
         | 
| 27 31 | 
             
                  "Type" : "AWS::EC2::Instance",
         | 
| 28 32 | 
             
                  "Properties" : {
         | 
| 29 | 
            -
                    "ImageId" : "{{ImageId}}" | 
| 30 | 
            -
                    "InstanceType" : "{{InstanceType}}"
         | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            +
                    "ImageId" : "{{ImageId}}"
         | 
| 34 | 
            +
                    , "InstanceType" : "{{InstanceType}}"
         | 
| 35 | 
            +
                    {{#SecurityGroup}}, "SecurityGroups" : [ { "Ref" : "{{SecurityGroup}}" } ]{{/SecurityGroup}}
         | 
| 36 | 
            +
                  }
         | 
| 37 | 
            +
                }{{_comma}}
         | 
| @@ -0,0 +1,37 @@ | |
| 1 | 
            +
            {{!
         | 
| 2 | 
            +
             | 
| 3 | 
            +
             | 
| 4 | 
            +
            ++start++
         | 
| 5 | 
            +
             | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## <a id="resourceSecurityGroup.mustache"></a>resourceSecurityGroup.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            Create an EC2 Security Group
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            **Attributes**: context=  `./resources/InstanceSecurityGroup`
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            * `Name` : of the security group
         | 
| 14 | 
            +
            * `IngressCidrIp`: CIDR for to inbound traffic (ingress)
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            **Actions**:
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            * **Name**:  `Name`
         | 
| 19 | 
            +
            * **Type**: "AWS::EC2::SecurityGroup"
         | 
| 20 | 
            +
            * **Properties.SecurityGroupIngress[0].CidrIp**: `IngressCidrIp`
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            ++close++
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            }}
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                "{{Name}}" : {
         | 
| 27 | 
            +
                  "Type" : "AWS::EC2::SecurityGroup",
         | 
| 28 | 
            +
                  "Properties" : {
         | 
| 29 | 
            +
                    "GroupDescription" : "Enable SSH access via port 22",
         | 
| 30 | 
            +
                    "SecurityGroupIngress" : [ {
         | 
| 31 | 
            +
                      "IpProtocol" : "tcp",
         | 
| 32 | 
            +
                      "FromPort" : "22",
         | 
| 33 | 
            +
                      "ToPort" : "22",
         | 
| 34 | 
            +
                      "CidrIp" : "{{IngressCidrIp}}"
         | 
| 35 | 
            +
                    } ]
         | 
| 36 | 
            +
                  }
         | 
| 37 | 
            +
                }{{_comma}}
         | 
    
        data/demo/4/root.mustache
    CHANGED
    
    | @@ -37,9 +37,10 @@ CONTENT section | |
| 37 37 |  | 
| 38 38 | 
             
            # <a id="top">aws-must demo 4 template</a>
         | 
| 39 39 |  | 
| 40 | 
            -
            Creates  | 
| 41 | 
            -
            (e.g. ami-00dae61d) and `InstanceType` (e.g. t2.micro).
         | 
| 42 | 
            -
             | 
| 40 | 
            +
            Creates EC2 instances using YAML configuration defining `ImageId`
         | 
| 41 | 
            +
            (e.g. ami-00dae61d) and `InstanceType` (e.g. t2.micro).  Output
         | 
| 42 | 
            +
            section contains references to InstanceId and PublicId of the newly
         | 
| 43 | 
            +
            created EC2 instance.
         | 
| 43 44 |  | 
| 44 45 | 
             
            Supports only region `eu-central-1`. No ssh connection allowed by
         | 
| 45 46 | 
             
            default.
         | 
| @@ -49,6 +50,7 @@ default. | |
| 49 50 | 
             
            * `InstanceType`: EC2 resource instance type, (default: t2.micro)
         | 
| 50 51 |  | 
| 51 52 |  | 
| 53 | 
            +
             | 
| 52 54 | 
             
            ## Document Content
         | 
| 53 55 |  | 
| 54 56 | 
             
            This document is generated automically from `aws-must` -demo
         | 
| @@ -68,25 +70,26 @@ each template, it | |
| 68 70 | 
             
            * lists template actions, i.e.  output from template, or template
         | 
| 69 71 | 
             
              inclusion
         | 
| 70 72 |  | 
| 71 | 
            -
            ## <a id="root.mustache"></a>root.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 72 | 
            -
             | 
| 73 73 |  | 
| 74 | 
            -
             | 
| 74 | 
            +
            ## <a id="root.mustache"></a>root.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 75 75 |  | 
| 76 | 
            +
            Starting point of template rendering.
         | 
| 76 77 |  | 
| 77 78 | 
             
            **Attributes**: context= `.`
         | 
| 78 79 |  | 
| 79 80 | 
             
            * `description`: description for the CF template
         | 
| 80 81 |  | 
| 81 | 
            -
             | 
| 82 82 | 
             
            **Actions**:
         | 
| 83 83 |  | 
| 84 84 | 
             
            * **Description**: `description`
         | 
| 85 85 | 
             
            * **include** <a href="#resources.mustache">resources.mustache</a>
         | 
| 86 86 | 
             
            * **for** `resource` **in** `resource` **include** <a href="#resource.mustache">resource.mustache</a>
         | 
| 87 | 
            +
            * **for** `output` **in** `outputs` **include** <a href="#output.mustache">output.mustache</a>
         | 
| 88 | 
            +
             | 
| 87 89 |  | 
| 88 90 | 
             
            > resources
         | 
| 89 91 | 
             
            > resource
         | 
| 92 | 
            +
            > output
         | 
| 90 93 |  | 
| 91 94 | 
             
            ++close++
         | 
| 92 95 |  | 
| @@ -97,13 +100,17 @@ Root template | |
| 97 100 |  | 
| 98 101 | 
             
              "Description" : "{{description}}",
         | 
| 99 102 |  | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 103 | 
             
              "Resources" : {
         | 
| 103 104 |  | 
| 104 105 | 
             
                {{> resources }}
         | 
| 105 106 | 
             
                {{# resources }}{{> resource }}{{/ resources }}
         | 
| 106 107 |  | 
| 108 | 
            +
              },
         | 
| 109 | 
            +
             | 
| 110 | 
            +
              "Outputs" : {
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                {{# outputs }}{{> output }}{{/ outputs }}
         | 
| 113 | 
            +
             | 
| 107 114 | 
             
              }
         | 
| 108 115 |  | 
| 109 116 | 
             
            }
         | 
    
        data/demo/5/conf.yaml
    CHANGED
    
    | @@ -1,10 +1,10 @@ | |
| 1 1 | 
             
            -- demo/2 : added description property
         | 
| 2 2 |  | 
| 3 3 |  | 
| 4 | 
            -
            description: "demo/ | 
| 4 | 
            +
            description: "demo/6 - A simple Amazon EC2 instance created using aws-must tool
         | 
| 5 5 | 
             
                         - Minimum Viable Solution to Manage CloudFormation
         | 
| 6 | 
            -
                         Templates. This version  | 
| 7 | 
            -
                         to  | 
| 6 | 
            +
                         Templates. This version uses AWSInstanceType2Arch and AWSRegionArch2AMI 
         | 
| 7 | 
            +
                         to define 64bit hmv 't2.micro' instances AMIs for several Amazon regions."
         | 
| 8 8 |  | 
| 9 9 |  | 
| 10 10 | 
             
            parameters:
         | 
| @@ -19,7 +19,6 @@ resources: | |
| 19 19 |  | 
| 20 20 | 
             
                    -  Instance: 
         | 
| 21 21 | 
             
                             Name: &Resource_1 MyEC2Instance
         | 
| 22 | 
            -
                             ImageId: ami-00dae61d
         | 
| 23 22 | 
             
                             InstanceType: *Param_InstanceType
         | 
| 24 23 |  | 
| 25 24 |  | 
| 
            File without changes
         | 
    
        data/demo/5/output.mustache
    CHANGED
    
    | @@ -5,7 +5,6 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            ## <a id="output.mustache"></a>output.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 7 7 |  | 
| 8 | 
            -
             | 
| 9 8 | 
             
            Create one output entry to CloudFormation JSON output section
         | 
| 10 9 |  | 
| 11 10 | 
             
            **Attributes**: context= `./outputs`
         | 
| @@ -26,6 +25,8 @@ Create one output entry to CloudFormation JSON output section | |
| 26 25 | 
             
            * **Value**: **Ref** if `Ref`
         | 
| 27 26 | 
             
            * **Value**: `Attr.Ref`, `Attr.Name` if `Attr`
         | 
| 28 27 |  | 
| 28 | 
            +
             | 
| 29 | 
            +
             | 
| 29 30 | 
             
            ++close++
         | 
| 30 31 |  | 
| 31 32 | 
             
            }}
         | 
    
        data/demo/5/resource.mustache
    CHANGED
    
    | @@ -6,12 +6,14 @@ | |
| 6 6 |  | 
| 7 7 | 
             
            ## <a id="resource.mustache"></a>resource.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 8 8 |  | 
| 9 | 
            +
             | 
| 9 10 | 
             
            Dispatches resource sub-type templates based resource Type propertys
         | 
| 10 11 |  | 
| 11 12 | 
             
            **Attributes**: context=  `./resources`
         | 
| 12 13 |  | 
| 13 14 | 
             
            * `Instance`: sub-document defining an EC instance
         | 
| 14 15 |  | 
| 16 | 
            +
             | 
| 15 17 | 
             
            **Actions**:
         | 
| 16 18 |  | 
| 17 19 | 
             
            * include <a href="#resourceInstance.mustache">resourceInstance.mustache</a> if `Instance` 
         | 
| @@ -21,6 +23,7 @@ Dispatches resource sub-type templates based resource Type propertys | |
| 21 23 | 
             
            ++close++
         | 
| 22 24 |  | 
| 23 25 |  | 
| 26 | 
            +
             | 
| 24 27 | 
             
            }}
         | 
| 25 28 |  | 
| 26 29 | 
             
            {{# Instance }}{{> resourceInstance}}{{/ Instance }}
         | 
| @@ -4,7 +4,6 @@ | |
| 4 4 | 
             
            ++start++
         | 
| 5 5 |  | 
| 6 6 |  | 
| 7 | 
            -
             | 
| 8 7 | 
             
            ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 9 8 |  | 
| 10 9 | 
             
            Create an EC2 instance
         | 
| @@ -14,12 +13,12 @@ Create an EC2 instance | |
| 14 13 | 
             
            * `Name`: name of the EC2 instance to create
         | 
| 15 14 | 
             
            * `InstanceType` : The instance type, such as t2.micro. 
         | 
| 16 15 |  | 
| 17 | 
            -
            **Actions**:
         | 
| 18 16 |  | 
| 17 | 
            +
            **Actions**:
         | 
| 19 18 |  | 
| 20 19 | 
             
            * **Name**:  `Name`
         | 
| 21 20 | 
             
            * **Type**: 'AWS::EC2::Instance'
         | 
| 22 | 
            -
            * **ImageId**: ` | 
| 21 | 
            +
            * **ImageId**: **AWSRegionArch2AMI**( 'AWS::Region', **AWSInstanceType2Arch**(`InstanceType`))
         | 
| 23 22 |  | 
| 24 23 | 
             
            ++close++
         | 
| 25 24 |  | 
| @@ -29,7 +28,8 @@ Create an EC2 instance | |
| 29 28 | 
             
                "{{Name}}" : {
         | 
| 30 29 | 
             
                  "Type" : "AWS::EC2::Instance",
         | 
| 31 30 | 
             
                  "Properties" : {
         | 
| 32 | 
            -
                    "ImageId" : "{ | 
| 31 | 
            +
                    "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
         | 
| 32 | 
            +
            	 	    { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "{{InstanceType}}", "Arch" ] } ] },
         | 
| 33 33 | 
             
                    "InstanceType" : "{{InstanceType}}"
         | 
| 34 34 | 
             
                  } {{! Propertites }}
         | 
| 35 35 | 
             
                }{{_comma}}
         | 
    
        data/demo/5/resources.mustache
    CHANGED
    
    | @@ -2,9 +2,19 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            ++start++
         | 
| 4 4 |  | 
| 5 | 
            -
            ## resources.mustache
         | 
| 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)
         | 
| 6 17 |  | 
| 7 | 
            -
            Nothing created here
         | 
| 8 18 |  | 
| 9 19 | 
             
            ++close++
         | 
| 10 20 |  | 
    
        data/demo/5/root.mustache
    CHANGED
    
    | @@ -7,7 +7,6 @@ STYLE section | |
| 7 7 | 
             
            ==================================================================
         | 
| 8 8 |  | 
| 9 9 | 
             
            ++start++
         | 
| 10 | 
            -
             | 
| 11 10 | 
             
            <style>
         | 
| 12 11 | 
             
            h1 {
         | 
| 13 12 | 
             
                color:blue; 
         | 
| @@ -21,6 +20,9 @@ h3 { | |
| 21 20 | 
             
                  color:blue;
         | 
| 22 21 | 
             
                  font-size: 1.5em;
         | 
| 23 22 | 
             
               }
         | 
| 23 | 
            +
            .navigator {
         | 
| 24 | 
            +
                  font-size: 0.5em;
         | 
| 25 | 
            +
               }
         | 
| 24 26 | 
             
            body {
         | 
| 25 27 | 
             
                background-color: #b0c4de;
         | 
| 26 28 | 
             
            } 
         | 
| @@ -37,20 +39,20 @@ CONTENT section | |
| 37 39 |  | 
| 38 40 | 
             
            # <a id="top">aws-must demo 5 template</a>
         | 
| 39 41 |  | 
| 40 | 
            -
            Creates EC2 instances using YAML configuration defining ` | 
| 41 | 
            -
            (e.g.  | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 42 | 
            +
            Creates EC2 instances using YAML configuration defining `InstanceType`
         | 
| 43 | 
            +
            (e.g. t2.micro).  `ImageId` of the AMI is determined using
         | 
| 44 | 
            +
            CloudFormation mapping on `InstanceType` and region. Supported regions
         | 
| 45 | 
            +
            are ap-northeast-1, ap-southeast-1, ap-southeast-2, cn-north-1,
         | 
| 46 | 
            +
            eu-central-1, eu-west-1, sa-east-1, us-east-1, us-gov-west-1,
         | 
| 47 | 
            +
            us-west-1, us-west-2.  Output section contains references to
         | 
| 48 | 
            +
            InstanceId and PublicId of the newly created EC2 instance.
         | 
| 47 49 |  | 
| 48 50 | 
             
            **Parameters**:
         | 
| 49 51 |  | 
| 50 52 | 
             
            * `InstanceType`: EC2 resource instance type, (default: t2.micro)
         | 
| 51 53 |  | 
| 52 54 |  | 
| 53 | 
            -
             | 
| 55 | 
            +
            No ssh connection allowed by default.
         | 
| 54 56 |  | 
| 55 57 | 
             
            ## Document Content
         | 
| 56 58 |  | 
| @@ -71,6 +73,30 @@ each template, it | |
| 71 73 | 
             
            * lists template actions, i.e.  output from template, or template
         | 
| 72 74 | 
             
              inclusion
         | 
| 73 75 |  | 
| 76 | 
            +
            ### Table of contents
         | 
| 77 | 
            +
            <ul>
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            <li><a href="#root.mustache">root.mustache</a>: root template =
         | 
| 80 | 
            +
            starting point of template rendering</li>
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            <li><a href="#mappings.mustache">mappings.mustache</a>matches a key to
         | 
| 83 | 
            +
            a corresponding set of named values</li>
         | 
| 84 | 
            +
             | 
| 85 | 
            +
            <li>Resources</li>
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            <ul>
         | 
| 88 | 
            +
             | 
| 89 | 
            +
            <li><a href="#resources.mustache">resources.mustache</a>: fixed
         | 
| 90 | 
            +
            resources</li>
         | 
| 91 | 
            +
             | 
| 92 | 
            +
            <li><a href="#resource.mustache">resource.mustache</a>: dispatch
         | 
| 93 | 
            +
            resource based on resource type</li> <li><a
         | 
| 94 | 
            +
            href="#resourceInstance.mustache">resourceInstance.mustache</a>create
         | 
| 95 | 
            +
            an EC2 instance</li>
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            </ul><li><a href="#output.mustache">output.mustache</a>:values in
         | 
| 98 | 
            +
            response to describe stack calls </li> </ul>
         | 
| 99 | 
            +
             | 
| 74 100 |  | 
| 75 101 | 
             
            ## <a id="root.mustache"></a>root.mustache <a class='navigator' href='#top'">[top]</a>
         | 
| 76 102 |  | 
| @@ -83,15 +109,18 @@ Starting point of template rendering. | |
| 83 109 | 
             
            **Actions**:
         | 
| 84 110 |  | 
| 85 111 | 
             
            * **Description**: `description`
         | 
| 112 | 
            +
            * **include** <a href="#mappings.mustache">mappings.mustache</a>
         | 
| 86 113 | 
             
            * **include** <a href="#resources.mustache">resources.mustache</a>
         | 
| 87 114 | 
             
            * **for** `resource` **in** `resource` **include** <a href="#resource.mustache">resource.mustache</a>
         | 
| 88 115 | 
             
            * **for** `output` **in** `outputs` **include** <a href="#output.mustache">output.mustache</a>
         | 
| 89 116 |  | 
| 90 117 |  | 
| 118 | 
            +
            > mappings
         | 
| 91 119 | 
             
            > resources
         | 
| 92 120 | 
             
            > resource
         | 
| 93 121 | 
             
            > output
         | 
| 94 122 |  | 
| 123 | 
            +
             | 
| 95 124 | 
             
            ++close++
         | 
| 96 125 |  | 
| 97 126 | 
             
            }}
         | 
| @@ -101,6 +130,10 @@ Starting point of template rendering. | |
| 101 130 |  | 
| 102 131 | 
             
              "Description" : "{{description}}",
         | 
| 103 132 |  | 
| 133 | 
            +
              "Mappings" : {
         | 
| 134 | 
            +
                {{> mappings }}
         | 
| 135 | 
            +
               },
         | 
| 136 | 
            +
             | 
| 104 137 | 
             
              "Resources" : {
         | 
| 105 138 |  | 
| 106 139 | 
             
                {{> resources }}
         | 
    
        data/demo/6/conf.yaml
    CHANGED
    
    | @@ -1,11 +1,5 @@ | |
| 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 1 |  | 
| 2 | 
            +
            description: "demo/6 - A simple Amazon EC2 instance created using aws-must tool"
         | 
| 9 3 |  | 
| 10 4 | 
             
            parameters:
         | 
| 11 5 |  | 
| @@ -14,18 +8,43 @@ parameters: | |
| 14 8 | 
             
                       Description: EC2 reousrce instance type
         | 
| 15 9 | 
             
                       Value: &Param_InstanceType t2.micro
         | 
| 16 10 |  | 
| 11 | 
            +
                    -  Name: &Param_KeyName KeyName
         | 
| 12 | 
            +
                       Type: "AWS::EC2::KeyPair::KeyName"
         | 
| 13 | 
            +
                       Description: Name of an existing EC2 KeyPair to enable SSH access to the instance
         | 
| 14 | 
            +
                       Value: demo-key
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                    -  Name: &Param_SSHLocation  SSHLocation
         | 
| 17 | 
            +
                       Type: String
         | 
| 18 | 
            +
                       Description: The IP address range that can be used to SSH to the EC2 instances
         | 
| 19 | 
            +
                       Value: "0.0.0.0/0"
         | 
| 20 | 
            +
             | 
| 17 21 |  | 
| 18 22 | 
             
            resources:
         | 
| 19 23 |  | 
| 24 | 
            +
                    - InstanceSecurityGroup:
         | 
| 25 | 
            +
                             Name: &DefaultSG MyDefaultSecurityGroup
         | 
| 26 | 
            +
                             IngressRef: *Param_SSHLocation
         | 
| 27 | 
            +
             | 
| 20 28 | 
             
                    -  Instance: 
         | 
| 21 29 | 
             
                             Name: &Resource_1 MyEC2Instance
         | 
| 22 30 | 
             
                             InstanceType: *Param_InstanceType
         | 
| 31 | 
            +
                             KeyName: *Param_KeyName
         | 
| 32 | 
            +
                             SecurityGroup: *DefaultSG
         | 
| 33 | 
            +
                             tags:
         | 
| 34 | 
            +
                                - Key: demotag1
         | 
| 35 | 
            +
                                  Value: demotag1 value
         | 
| 23 36 |  | 
| 24 37 |  | 
| 25 38 | 
             
            outputs:
         | 
| 26 39 |  | 
| 27 | 
            -
                    -  Name:  | 
| 40 | 
            +
                    -  Name: Instance1
         | 
| 28 41 | 
             
                       Description: InstanceId of the newly created EC2 instance
         | 
| 29 42 | 
             
                       Ref:  *Resource_1
         | 
| 30 43 |  | 
| 31 44 |  | 
| 45 | 
            +
                    -  Name: IP1
         | 
| 46 | 
            +
                       Description: Public IP address of the newly created EC2 instance
         | 
| 47 | 
            +
                       Attr: 
         | 
| 48 | 
            +
                             Ref: *Resource_1
         | 
| 49 | 
            +
                             Name: PublicIp
         | 
| 50 | 
            +
             | 
| 
            File without changes
         | 
    
        data/demo/6/resource.mustache
    CHANGED
    
    | @@ -12,13 +12,21 @@ Dispatches resource sub-type templates based resource Type propertys | |
| 12 12 | 
             
            **Attributes**: context=  `./resources`
         | 
| 13 13 |  | 
| 14 14 | 
             
            * `Instance`: sub-document defining an EC instance
         | 
| 15 | 
            +
            * `SecurityGroup`: sub-document defining an <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html">AWS::EC2::SecurityGroup</a>
         | 
| 15 16 |  | 
| 16 17 |  | 
| 17 18 | 
             
            **Actions**:
         | 
| 18 19 |  | 
| 19 | 
            -
            * include <a href="#resourceInstance.mustache">resourceInstance.mustache</a> if `Instance` 
         | 
| 20 | 
            +
            * **include** <a href="#resourceInstance.mustache">resourceInstance.mustache</a> **if** `Instance` 
         | 
| 21 | 
            +
            * **include** <a href="#resourceSecurityGroup.mustache">resourceSecurityGroup.mustache</a> **if** `SecurityGroup` 
         | 
| 22 | 
            +
             | 
| 23 | 
            +
             | 
| 24 | 
            +
            **Included resources**
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            * `resourceInstance`
         | 
| 20 27 |  | 
| 21 28 | 
             
            > resourceInstance
         | 
| 29 | 
            +
            > resourceSecurityGroup.mustache
         | 
| 22 30 |  | 
| 23 31 | 
             
            ++close++
         | 
| 24 32 |  | 
| @@ -27,3 +35,4 @@ Dispatches resource sub-type templates based resource Type propertys | |
| 27 35 | 
             
            }}
         | 
| 28 36 |  | 
| 29 37 | 
             
            {{# Instance }}{{> resourceInstance}}{{/ Instance }}
         | 
| 38 | 
            +
            {{# InstanceSecurityGroup }}{{> resourceSecurityGroup}}{{/ InstanceSecurityGroup }}
         | 
| @@ -12,13 +12,20 @@ Create an EC2 instance | |
| 12 12 |  | 
| 13 13 | 
             
            * `Name`: name of the EC2 instance to create
         | 
| 14 14 | 
             
            * `InstanceType` : The instance type, such as t2.micro. 
         | 
| 15 | 
            +
            * `tags` : array of tag sub-documents for EC2 instance
         | 
| 15 16 |  | 
| 16 17 |  | 
| 17 18 | 
             
            **Actions**:
         | 
| 18 19 |  | 
| 19 20 | 
             
            * **Name**:  `Name`
         | 
| 20 21 | 
             
            * **Type**: 'AWS::EC2::Instance'
         | 
| 22 | 
            +
            * **for** `tag` **in** `tags` **include**  <a href="#tag.mustache">tag.mustache</a>
         | 
| 23 | 
            +
            * **SecurityGroups.Ref**: `SecurityGroup` if `SecurityGroup`
         | 
| 21 24 | 
             
            * **ImageId**: **AWSRegionArch2AMI**( 'AWS::Region', **AWSInstanceType2Arch**(`InstanceType`))
         | 
| 25 | 
            +
            * **KeyName**: `KeyName` if `KeyName`
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            > tag
         | 
| 28 | 
            +
             | 
| 22 29 |  | 
| 23 30 | 
             
            ++close++
         | 
| 24 31 |  | 
| @@ -29,7 +36,10 @@ Create an EC2 instance | |
| 29 36 | 
             
                  "Type" : "AWS::EC2::Instance",
         | 
| 30 37 | 
             
                  "Properties" : {
         | 
| 31 38 | 
             
                    "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
         | 
| 32 | 
            -
            	 	    { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "{{InstanceType}}", "Arch" ] } ] } | 
| 33 | 
            -
                    "InstanceType" : "{{InstanceType}}"
         | 
| 34 | 
            -
             | 
| 39 | 
            +
            	 	    { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "{{InstanceType}}", "Arch" ] } ] }
         | 
| 40 | 
            +
                    , "InstanceType" : "{{InstanceType}}"
         | 
| 41 | 
            +
                    , "Tags" : [ {{#tags}}{{>tag}}{{/tags}} ]
         | 
| 42 | 
            +
                    {{#SecurityGroup}}, "SecurityGroups" : [ { "Ref" : "{{SecurityGroup}}" } ]{{/SecurityGroup}}
         | 
| 43 | 
            +
                    {{#KeyName}}, "KeyName" : { "Ref" : "{{KeyName}}" }{{/KeyName}}
         | 
| 44 | 
            +
                  } 
         | 
| 35 45 | 
             
                }{{_comma}}
         | 
| 
            File without changes
         | 
    
        data/demo/6/root.mustache
    CHANGED
    
    | @@ -39,20 +39,29 @@ CONTENT section | |
| 39 39 |  | 
| 40 40 | 
             
            # <a id="top">aws-must demo 6 template</a>
         | 
| 41 41 |  | 
| 42 | 
            -
            Creates  | 
| 43 | 
            -
            (e.g. t2.micro).  `ImageId` of the AMI is determined using
         | 
| 44 | 
            -
            CloudFormation mapping on `InstanceType` and region. Supported regions
         | 
| 45 | 
            -
            are ap-northeast-1, ap-southeast-1, ap-southeast-2, cn-north-1,
         | 
| 46 | 
            -
            eu-central-1, eu-west-1, sa-east-1, us-east-1, us-gov-west-1,
         | 
| 47 | 
            -
            us-west-1, us-west-2.  Output section contains references to
         | 
| 48 | 
            -
            InstanceId and PublicId of the newly created EC2 instance.
         | 
| 42 | 
            +
            Creates 
         | 
| 49 43 |  | 
| 50 | 
            -
            ** | 
| 44 | 
            +
            * **EC2 SecurityGroup** allowing ssh via port 22 from a location given
         | 
| 45 | 
            +
                as `SSHLocation` parameter
         | 
| 51 46 |  | 
| 52 | 
            -
            *  | 
| 47 | 
            +
            * **EC2 instances** using YAML parameter `InstanceType`
         | 
| 48 | 
            +
              (e.g. t2.micro).
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              * `ImageId` of the AMI is determined using CloudFormation mapping on
         | 
| 51 | 
            +
                `InstanceType` and region. Supported regions are ap-northeast-1,
         | 
| 52 | 
            +
                ap-southeast-1, ap-southeast-2, cn-north-1, eu-central-1,
         | 
| 53 | 
            +
                eu-west-1, sa-east-1, us-east-1, us-gov-west-1, us-west-1,
         | 
| 54 | 
            +
                us-west-2.  
         | 
| 55 | 
            +
             | 
| 56 | 
            +
              * output section contains references to InstanceId and PublicId of
         | 
| 57 | 
            +
                the newly created EC2 instance.
         | 
| 53 58 |  | 
| 54 59 |  | 
| 55 | 
            -
             | 
| 60 | 
            +
            **Parameters**:
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            * `InstanceType`: EC2 resource instance type, (default: t2.micro)
         | 
| 63 | 
            +
            * `KeyName` : Name of an existing EC2 KeyPair to enable SSH access to the instance, (default: demo-key)
         | 
| 64 | 
            +
            * `SSHLocation`: The IP address range that can be used to SSH to the EC2 instances default: 0.0.0.0/0)
         | 
| 56 65 |  | 
| 57 66 | 
             
            ## Document Content
         | 
| 58 67 |  | 
| @@ -68,7 +77,7 @@ each template, it | |
| 68 77 | 
             
            * gives a general description of the template
         | 
| 69 78 |  | 
| 70 79 | 
             
            * documents the attribute context e.g. `.` or `./resources/Instance`,
         | 
| 71 | 
            -
              and attributes  | 
| 80 | 
            +
              and attributes referenced within the template
         | 
| 72 81 |  | 
| 73 82 | 
             
            * lists template actions, i.e.  output from template, or template
         | 
| 74 83 | 
             
              inclusion
         | 
| @@ -79,6 +88,9 @@ each template, it | |
| 79 88 | 
             
            <li><a href="#root.mustache">root.mustache</a>: root template =
         | 
| 80 89 | 
             
            starting point of template rendering</li>
         | 
| 81 90 |  | 
| 91 | 
            +
            <li><a href="#parameter.mustache">parameter.mustache</a>: create one
         | 
| 92 | 
            +
            parameter entry to CloudFormation JSON parameter section</li>
         | 
| 93 | 
            +
             | 
| 82 94 | 
             
            <li><a href="#mappings.mustache">mappings.mustache</a>matches a key to
         | 
| 83 95 | 
             
            a corresponding set of named values</li>
         | 
| 84 96 |  | 
| @@ -90,11 +102,22 @@ a corresponding set of named values</li> | |
| 90 102 | 
             
            resources</li>
         | 
| 91 103 |  | 
| 92 104 | 
             
            <li><a href="#resource.mustache">resource.mustache</a>: dispatch
         | 
| 93 | 
            -
            resource based on resource type</li> | 
| 94 | 
            -
            href="#resourceInstance.mustache">resourceInstance.mustache</a>create
         | 
| 95 | 
            -
            an EC2 instance</li>
         | 
| 105 | 
            +
            resource based on resource type</li>
         | 
| 96 106 |  | 
| 97 | 
            -
             | 
| 107 | 
            +
            <ul> <li><a
         | 
| 108 | 
            +
            href="#resourceSecurityGroup.mustache">resourceSecurityGroup.mustache.mustache</a>:
         | 
| 109 | 
            +
            create an security group for accessing EC2 instances</li>
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            <li><a
         | 
| 112 | 
            +
            href="#resourceInstance.mustache">resourceInstance.mustache</a>:
         | 
| 113 | 
            +
            create an EC2 instance</li>
         | 
| 114 | 
            +
             | 
| 115 | 
            +
            <ul><li><a href="#tag.mustache">tag.mustache</a>: add key-value tag property
         | 
| 116 | 
            +
            to an</li><ul>
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            </ul></ul></ul></ul>
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            <li><a href="#output.mustache">output.mustache</a>: values in
         | 
| 98 121 | 
             
            response to describe stack calls </li> </ul>
         | 
| 99 122 |  | 
| 100 123 |  | 
| @@ -105,16 +128,22 @@ Starting point of template rendering. | |
| 105 128 | 
             
            **Attributes**: context= `.`
         | 
| 106 129 |  | 
| 107 130 | 
             
            * `description`: description for the CF template
         | 
| 131 | 
            +
            * `parameters`: array of parameter sub-documents for CloudFormation Parameters -section
         | 
| 132 | 
            +
            * `resources`: array of resource sub-documents for CloudFormation Resources -section
         | 
| 133 | 
            +
            * `outputs`: array of output sub-documents for CloudFormation Outputs -section
         | 
| 134 | 
            +
             | 
| 108 135 |  | 
| 109 136 | 
             
            **Actions**:
         | 
| 110 137 |  | 
| 111 138 | 
             
            * **Description**: `description`
         | 
| 139 | 
            +
            * **for** `parameter` **in** `parameters`  **include** <a href="#parameter.mustache">parameter.mustache</a>
         | 
| 112 140 | 
             
            * **include** <a href="#mappings.mustache">mappings.mustache</a>
         | 
| 113 141 | 
             
            * **include** <a href="#resources.mustache">resources.mustache</a>
         | 
| 114 142 | 
             
            * **for** `resource` **in** `resource` **include** <a href="#resource.mustache">resource.mustache</a>
         | 
| 115 143 | 
             
            * **for** `output` **in** `outputs` **include** <a href="#output.mustache">output.mustache</a>
         | 
| 116 144 |  | 
| 117 145 |  | 
| 146 | 
            +
            > parameter
         | 
| 118 147 | 
             
            > mappings
         | 
| 119 148 | 
             
            > resources
         | 
| 120 149 | 
             
            > resource
         | 
| @@ -130,6 +159,10 @@ Starting point of template rendering. | |
| 130 159 |  | 
| 131 160 | 
             
              "Description" : "{{description}}",
         | 
| 132 161 |  | 
| 162 | 
            +
              "Parameters" : {
         | 
| 163 | 
            +
                {{# parameters }}{{> parameter }}{{/ parameters }}
         | 
| 164 | 
            +
              },
         | 
| 165 | 
            +
             | 
| 133 166 | 
             
              "Mappings" : {
         | 
| 134 167 | 
             
                {{> mappings }}
         | 
| 135 168 | 
             
               },
         | 
    
        data/demo/{8 → 6}/tag.mustache
    RENAMED
    
    | 
            File without changes
         | 
    
        data/demo/7/conf.yaml
    CHANGED
    
    | @@ -1,9 +1,7 @@ | |
| 1 | 
            -
            -- demo/2 : added description property
         | 
| 2 | 
            -
             | 
| 3 1 |  | 
| 4 2 | 
             
            description: "demo/7 - A simple Amazon EC2 instance created using aws-must tool
         | 
| 5 3 | 
             
                         - Minimum Viable Solution to Manage CloudFormation
         | 
| 6 | 
            -
                         Templates.  | 
| 4 | 
            +
                         Templates. Adds support installing Chef"
         | 
| 7 5 |  | 
| 8 6 | 
             
            parameters:
         | 
| 9 7 |  | 
| @@ -22,6 +20,11 @@ parameters: | |
| 22 20 | 
             
                       Description: The IP address range that can be used to SSH to the EC2 instances
         | 
| 23 21 | 
             
                       Value: "0.0.0.0/0"
         | 
| 24 22 |  | 
| 23 | 
            +
                    -  Name: ChefVersion
         | 
| 24 | 
            +
                       Type: String
         | 
| 25 | 
            +
                       Description: Chef version to install
         | 
| 26 | 
            +
                       Value: &Param_ChefVersion 11.18
         | 
| 27 | 
            +
             | 
| 25 28 |  | 
| 26 29 | 
             
            resources:
         | 
| 27 30 |  | 
| @@ -34,6 +37,8 @@ resources: | |
| 34 37 | 
             
                             InstanceType: *Param_InstanceType
         | 
| 35 38 | 
             
                             KeyName: *Param_KeyName
         | 
| 36 39 | 
             
                             SecurityGroup: *DefaultSG
         | 
| 40 | 
            +
                             InstallChef: 
         | 
| 41 | 
            +
                                - Version: *Param_ChefVersion
         | 
| 37 42 | 
             
                             tags:
         | 
| 38 43 | 
             
                                - Key: demotag1
         | 
| 39 44 | 
             
                                  Value: demotag1 value
         |