-
Notifications
You must be signed in to change notification settings - Fork 2
/
module.yml
137 lines (137 loc) · 5.25 KB
/
module.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
# Copyright 2018 widdix GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules: RDS MySQL'
# cfn-modules:implements(ExposeName, ExposeDnsName)
Parameters:
VpcModule:
Description: 'Stack name of vpc module.'
Type: String
ClientSgModule:
Description: 'Stack name of client-sg module.'
Type: String
AlertingModule:
Description: 'Optional but recommended stack name of alerting module.'
Type: String
Default: ''
HostedZoneModule:
Description: 'Optional but recommended stack name of module implementing HostedZone.'
Type: String
Default: ''
BastionModule:
Description: 'Optional but recommended stack name of module implementing Bastion.'
Type: String
Default: ''
KmsKeyModule:
Description: 'Optional but recommended stack name of kms-key module (ignored when DBSnapshotIdentifier is set, value used from snapshot).'
Type: String
Default: ''
SecretModule:
Description: 'Optional but recommended stack name of secret module.'
Type: String
Default: ''
DBSnapshotIdentifier:
Description: 'Optional name or Amazon Resource Name (ARN) of the DB snapshot from which you want to restore (leave blank to create an empty database).'
Type: String
Default: ''
DBAllocatedStorage:
Description: 'The allocated storage size, specified in GB (ignored when DBSnapshotIdentifier is set, value used from snapshot).'
Type: Number
Default: 5
MinValue: 5
MaxValue: 16384
DBInstanceClass:
Description: 'The instance type of the database.'
Type: String
Default: 'db.t4g.micro'
DBName:
Description: 'Name of the database (ignored when DBSnapshotIdentifier is set, value used from snapshot).'
Type: String
Default: ''
DBBackupRetentionPeriod:
Description: 'The number of days to keep snapshots of the database.'
Type: Number
Default: 35
MinValue: 0
MaxValue: 35
DBMasterUsername:
Description: 'The master user name for the DB instance (ignored when DBSnapshotIdentifier is set, value used from snapshot).'
Type: String
Default: master
DBMasterUserPassword:
Description: 'The master password for the DB instance (ignored when DBSnapshotIdentifier is set, value used from snapshot; also ignored if SecretModule is set).'
Type: String
NoEcho: true
Default: ''
DBMultiAZ:
Description: 'Specifies if the database instance is deployed to multiple Availability Zones for HA.'
Type: String
Default: true
AllowedValues: [true, false]
SubDomainNameWithDot:
Description: 'Name that is used to create the DNS entry with trailing dot, e.g. §{SubDomainNameWithDot}§{HostedZoneName}. Leave blank for naked (or apex and bare) domain. Requires HostedZoneModule parameter!'
Type: String
Default: 'mysql.'
EngineVersion:
Description: 'MySQL version (e.g., 8.0.31)' # aws rds describe-db-engine-versions --engine mysql --query "DBEngineVersions[].EngineVersion"
Type: String
EnableIAMDatabaseAuthentication:
Description: 'Enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html).'
Type: String
AllowedValues: ['true', 'false']
Default: 'false'
Resources:
Instance:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !Ref VpcModule
ClientSgModule: !Ref ClientSgModule
AlertingModule: !Ref AlertingModule
HostedZoneModule: !Ref HostedZoneModule
BastionModule: !Ref BastionModule
KmsKeyModule: !Ref KmsKeyModule
SecretModule: !Ref SecretModule
Engine: mysql
EngineVersion: !Ref EngineVersion
EnginePort: '3306'
DBSnapshotIdentifier: !Ref DBSnapshotIdentifier
DBAllocatedStorage: !Ref DBAllocatedStorage
DBInstanceClass: !Ref DBInstanceClass
DBName: !Ref DBName
DBBackupRetentionPeriod: !Ref DBBackupRetentionPeriod
DBMasterUsername: !Ref DBMasterUsername
DBMasterUserPassword: !Ref DBMasterUserPassword
DBMultiAZ: !Ref DBMultiAZ
SubDomainNameWithDot: !Ref SubDomainNameWithDot
EnableIAMDatabaseAuthentication: !Ref EnableIAMDatabaseAuthentication
TemplateURL: './node_modules/@cfn-modules/rds-instance/module.yml'
Outputs:
ModuleId:
Value: 'rds-mysql'
ModuleVersion:
Value: '2.0.0'
StackName:
Value: !Ref 'AWS::StackName'
Name:
Description: 'The name of the database instance.'
Value: !GetAtt 'Instance.Outputs.Name'
Export:
Name: !Sub '${AWS::StackName}-Name'
DnsName:
Description: 'The connection endpoint for the database.'
Value: !GetAtt 'Instance.Outputs.DnsName'
Export:
Name: !Sub '${AWS::StackName}-DnsName'