Hello world sample enhancement

Did following changes:

1. Using OS::Nova::Server instead of AWS::EC2::Instance,
2. Naming in snake style instead of cammel style,
3. Make use of the two unused parameters.

Change-Id: Idf8a1cb3df9fde1cbbd21c931aec3988aa9d7140
This commit is contained in:
JUNJIE NAN 2014-07-29 22:33:38 +08:00
parent 7ec1eb9870
commit d0f9bcc441

View File

@ -1,29 +1,33 @@
# This is a hello world HOT template just defining a single compute instance #
# This is a hello world HOT template just defining a single compute
# server.
#
heat_template_version: 2013-05-23 heat_template_version: 2013-05-23
description: > description: >
Hello world HOT template that just defines a single compute instance. Hello world HOT template that just defines a single server.
Contains just base features to verify base HOT support. Contains just base features to verify base HOT support.
parameters: parameters:
KeyName: key_name:
type: string type: string
description: Name of an existing key pair to use for the instance description: Name of an existing key pair to use for the server
InstanceType: constraints:
- custom_constraint: nova.keypair
flavor:
type: string type: string
description: Instance type for the instance to be created description: Flavor for the server to be created
default: m1.small default: m1.small
constraints: constraints:
- allowed_values: [m1.tiny, m1.small, m1.large] - custom_constraint: nova.flavor
description: Value must be one of 'm1.tiny', 'm1.small' or 'm1.large' image:
ImageId:
type: string type: string
description: ID of the image to use for the instance description: Image ID or image name to use for the server
# parameters below are not used in template, but are for verifying parameter constraints:
# validation support in HOT - custom_constraint: glance.image
db_password: admin_pass:
type: string type: string
description: Database password description: Admin password
hidden: true hidden: true
constraints: constraints:
- length: { min: 6, max: 8 } - length: { min: 6, max: 8 }
@ -41,15 +45,22 @@ parameters:
description: Port number must be between 40000 and 60000 description: Port number must be between 40000 and 60000
resources: resources:
my_instance: server:
# Use an AWS resource type since this exists; so why use other name here? type: OS::Nova::Server
type: AWS::EC2::Instance
properties: properties:
KeyName: { get_param: KeyName } key_name: { get_param: key_name }
ImageId: { get_param: ImageId } image: { get_param: image }
InstanceType: { get_param: InstanceType } flavor: { get_param: flavor }
admin_pass: { get_param: admin_pass }
user_data:
str_replace:
template: |
#!/bin/bash
echo db_port
params:
db_port: { get_param: db_port }
outputs: outputs:
instance_ip: server_networks:
description: The IP address of the deployed instance description: The networks of the deployed server
value: { get_attr: [my_instance, PublicIp] } value: { get_attr: [server, networks] }