Skip to content

Commit 9546d29

Browse files
authored
Merge pull request #3 from aaronwalker/master
changes to support aurora config
2 parents 4558b10 + 0e99922 commit 9546d29

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

aurora-postgres.cfhighlander.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
CfhighlanderTemplate do
2+
3+
Name 'aurora-postgres'
4+
Description "Highlander Aurora Postgres component #{component_version}"
25
DependsOn '[email protected]'
6+
37
Parameters do
48
ComponentParam 'EnvironmentName', 'dev', isGlobal: true
59
ComponentParam 'EnvironmentType', 'development', isGlobal: true, allowedValues: ['development', 'production']
610
ComponentParam 'StackOctet', isGlobal: true
11+
712
MappingParam('WriterInstanceType') do
813
map 'EnvironmentType'
914
attribute 'WriterInstanceType'
@@ -19,6 +24,7 @@
1924
maximum_availability_zones.times do |az|
2025
ComponentParam "SubnetPersistence#{az}"
2126
end
27+
2228
ComponentParam 'SnapshotID'
2329
ComponentParam 'EnableReader', 'false'
2430
ComponentParam 'VPCId', type: 'AWS::EC2::VPC::Id'

aurora-postgres.cfndsl.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
Description "#{component_name} - #{component_version}"
44

55
Condition("EnableReader", FnEquals(Ref("EnableReader"), 'true'))
6+
Condition("UseUsernameAndPassword", FnEquals(Ref(:SnapshotID), ''))
7+
Condition("UseSnapshotID", FnNot(FnEquals(Ref(:SnapshotID), '')))
8+
69
az_conditions_resources('SubnetPersistence', maximum_availability_zones)
710

811
tags = []
@@ -26,7 +29,7 @@
2629

2730
RDS_DBClusterParameterGroup(:DBClusterParameterGroup) {
2831
Description FnJoin(' ', [ Ref(:EnvironmentName), component_name, 'cluster parameter group' ])
29-
Family 'aurora-postgresql'
32+
Family 'aurora-postgresql9.6'
3033
Parameters cluster_parameters if defined? cluster_parameters
3134
Tags tags + [{ Key: 'Name', Value: FnJoin('-', [ Ref(:EnvironmentName), component_name, 'cluster-parameter-group' ])}]
3235
}
@@ -35,8 +38,12 @@
3538
Engine 'aurora-postgresql'
3639
DBClusterParameterGroupName Ref(:DBClusterParameterGroup)
3740
SnapshotIdentifier Ref(:SnapshotID)
41+
SnapshotIdentifier FnIf('UseSnapshotID',Ref(:SnapshotID), Ref('AWS::NoValue'))
42+
MasterUsername FnIf('UseUsernameAndPassword', FnJoin('', [ '{{resolve:ssm:', FnSub(master_login['username_ssm_param']), ':1}}' ]), Ref('AWS::NoValue'))
43+
MasterUserPassword FnIf('UseUsernameAndPassword', FnJoin('', [ '{{resolve:ssm-secure:', FnSub(master_login['password_ssm_param']), ':1}}' ]), Ref('AWS::NoValue'))
3844
DBSubnetGroupName Ref(:DBClusterSubnetGroup)
3945
VpcSecurityGroupIds [ Ref(:SecurityGroup) ]
46+
Port cluster_port
4047
Tags tags + [{ Key: 'Name', Value: FnJoin('-', [ Ref(:EnvironmentName), component_name, 'cluster' ])}]
4148
}
4249

aurora-postgres.config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
maximum_availability_zones: 5
22
hostname: aurora2pg
33

4+
cluster_port: 5432
5+
6+
master_login:
7+
username_ssm_param: /rds/AURORA_POSTGRES_MASTER_USERNAME
8+
password_ssm_param: /rds/AURORA_POSTGRES_MASTER_PASSWORD
9+
410
# cluster_parameters:
511

612
# instance_parameters:

0 commit comments

Comments
 (0)