|
1 | 1 | CloudFormation do |
2 | 2 |
|
| 3 | + export = external_parameters.fetch(:export_name, external_parameters[:component_name]) |
| 4 | + |
3 | 5 | Condition("UseSnapshotID", FnNot(FnEquals(Ref(:SnapshotID), ''))) |
4 | 6 | Condition("CreateHostRecord", FnNot(FnEquals(Ref(:DnsDomain), ''))) |
5 | 7 | Condition("UseGlobalClusterIdentifier", FnNot(FnEquals(Ref(:GlobalClusterIdentifier), ''))) |
6 | 8 | Condition("UseUsernameAndPassword", FnAnd([FnEquals(Ref(:SnapshotID), ''), FnEquals(Ref(:GlobalClusterIdentifier), '')])) |
7 | 9 |
|
8 | 10 | aurora_tags = [] |
9 | 11 | tags = external_parameters.fetch(:tags, {}) |
10 | | - aurora_tags << { Key: 'Name', Value: FnSub("${EnvironmentName}-#{external_parameters[:component_name]}") } |
| 12 | + aurora_tags << { Key: 'Name', Value: FnSub("${EnvironmentName}-#{export}") } |
11 | 13 | aurora_tags << { Key: 'Environment', Value: Ref(:EnvironmentName) } |
12 | 14 | aurora_tags << { Key: 'EnvironmentType', Value: Ref(:EnvironmentType) } |
13 | 15 | aurora_tags.push(*tags.map {|k,v| {Key: k, Value: FnSub(v)}}).uniq { |h| h[:Key] } |
|
129 | 131 |
|
130 | 132 | Output(:SecurityGroupId) { |
131 | 133 | Value(FnGetAtt(:SecurityGroup, :GroupId)) |
132 | | - Export FnSub("${EnvironmentName}-#{external_parameters[:component_name]}-securitygroup-id") |
| 134 | + Export FnSub("${EnvironmentName}-#{export}-securitygroup-id") |
133 | 135 | } |
134 | 136 |
|
135 | 137 | RDS_DBSubnetGroup(:DBClusterSubnetGroup) { |
136 | 138 | SubnetIds Ref('SubnetIds') |
137 | | - DBSubnetGroupDescription FnSub("Aurora postgres #{component_name} subnets for the ${EnvironmentName} environment") |
| 139 | + DBSubnetGroupDescription FnSub("Aurora postgres #{export} subnets for the ${EnvironmentName} environment") |
138 | 140 | Tags aurora_tags |
139 | 141 | } |
140 | 142 |
|
141 | 143 | cluster_parameters = external_parameters.fetch(:cluster_parameters, nil) |
142 | 144 |
|
143 | 145 | RDS_DBClusterParameterGroup(:DBClusterParameterGroup) { |
144 | | - Description FnSub("Aurora postgres #{component_name} cluster parameters for the ${EnvironmentName} environment") |
| 146 | + Description FnSub("Aurora postgres #{export} cluster parameters for the ${EnvironmentName} environment") |
145 | 147 | Family family |
146 | 148 | Parameters cluster_parameters unless cluster_parameters.nil? |
147 | 149 | Tags aurora_tags |
|
162 | 164 |
|
163 | 165 | Output(:SecretCredentials) { |
164 | 166 | Value(Ref(:SecretCredentials)) |
165 | | - Export FnSub("${EnvironmentName}-#{external_parameters[:component_name]}-Secret") |
| 167 | + Export FnSub("${EnvironmentName}-#{export}-Secret") |
166 | 168 | } |
167 | 169 | else |
168 | 170 | instance_username = FnJoin('', [ '{{resolve:ssm:', FnSub(master_login['username_ssm_param']), ':1}}' ]) |
|
210 | 212 | instance_parameters = external_parameters.fetch(:instance_parameters, nil) |
211 | 213 |
|
212 | 214 | RDS_DBParameterGroup(:DBInstanceParameterGroup) { |
213 | | - Description FnSub("Aurora postgres #{component_name} instance parameters for the ${EnvironmentName} environment") |
| 215 | + Description FnSub("Aurora postgres #{export} instance parameters for the ${EnvironmentName} environment") |
214 | 216 | Family family |
215 | 217 | Parameters instance_parameters unless instance_parameters.nil? |
216 | 218 | Tags aurora_tags |
|
309 | 311 |
|
310 | 312 | Output(:ServiceRegistry) { |
311 | 313 | Value(Ref(:ServiceRegistry)) |
312 | | - Export FnSub("${EnvironmentName}-#{external_parameters[:component_name]}-CloudMapService") |
| 314 | + Export FnSub("${EnvironmentName}-#{export}-CloudMapService") |
313 | 315 | } |
314 | 316 | end |
315 | 317 |
|
316 | 318 | Output(:DBClusterId) { |
317 | 319 | Value(Ref(:DBCluster)) |
318 | | - Export FnSub("${EnvironmentName}-#{external_parameters[:component_name]}-dbcluster-id") |
| 320 | + Export FnSub("${EnvironmentName}-#{export}-dbcluster-id") |
319 | 321 | } |
320 | 322 |
|
321 | 323 | end |
0 commit comments