use openstack-db
[apex-tripleo-heat-templates.git] / mysql.yaml
1 HeatTemplateFormatVersion: '2012-12-12'
2 Description: 'HEAT Template - Dedicated MySQL server'
3 Parameters:
4   KeyName: 
5     Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
6     Type: String
7     Default: default
8   InstanceType:
9     Description: Use this flavor
10     Type: String
11     Default: m1.small
12   MySQLImage:
13     Type: String
14 Resources:
15   ApiAccessPolicy:
16     Type: OS::Heat::AccessPolicy
17     Properties:
18       AllowedResources: [ MySQL ]
19   ApiUser:
20     Type: AWS::IAM::User
21     Properties:
22       Policies: [ { Ref: ApiAccessPolicy } ]
23   MySQL:
24     Type: AWS::EC2::Instance
25     Metadata:
26       OpenStack::ImageBuilder::Elements: [ openstack-db ]
27       OpenStack::MySQL:
28         databases:
29           keystone:
30             userhandle: {Ref: KeystonePasswordHandle}
31       OpenStack::Heat::CFNTools:
32         AWSAccessKeyId:
33           Ref: ApiKey
34         AWSSecretAccessKey:
35           Fn::GetAtt: [ ApiKey, SecretAccessKey ]
36     Properties:
37       ImageId:
38         {Ref: MySQLImage}
39       InstanceType: {Ref: InstanceType}
40       KeyName: {Ref: KeyName}
41   KeystonePasswordHandle:
42     Type: AWS::CloudFormation:WaitConditionHandle
43     Properties:
44   KeystonePassword:
45     DependsOn: MySQL1
46     Type: AWS::CloudFormation::WaitCondition
47     Properties:
48       Handle: {Ref: KeystonePasswordHandle}
49       Timeout: 60
50 Outputs:
51     MySQLHost: 
52         Fn::GetAtt: [ MySQL , PrivateIp ]
53     KeystonePassword:
54         Fn::GetAtt: [ KeystonePassword, Data ]