Skip to content

Commit 1ee1607

Browse files
authored
Merge pull request #12 from base2Services/feature/optional-dns
Make DNS records conditional on use of DnsDomain param
2 parents 8d30731 + 19cb88d commit 1ee1607

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

aurora-postgres.cfndsl.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Condition("EnableReader", FnEquals(Ref("EnableReader"), 'true'))
44
Condition("UseUsernameAndPassword", FnEquals(Ref(:SnapshotID), ''))
55
Condition("UseSnapshotID", FnNot(FnEquals(Ref(:SnapshotID), '')))
6+
Condition("CreateHostRecord", FnNot(FnEquals(Ref(:DnsDomain), '')))
7+
Condition("CreateReaderRecord", FnAnd([FnEquals(Ref("EnableReader"), 'true'), Condition('CreateHostRecord')]))
68

79
aurora_tags = []
810
aurora_tags << { Key: 'Name', Value: FnSub("${EnvironmentName}-#{component_name}") }
@@ -110,7 +112,7 @@
110112
}
111113

112114
Route53_RecordSet(:DBClusterReaderRecord) {
113-
Condition(:EnableReader)
115+
Condition(:CreateReaderRecord)
114116
HostedZoneName FnJoin('', [ Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.'])
115117
Name FnJoin('', [ hostname_read_endpoint, '.', Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.' ])
116118
Type 'CNAME'
@@ -119,6 +121,7 @@
119121
}
120122

121123
Route53_RecordSet(:DBHostRecord) {
124+
Condition(:CreateHostRecord)
122125
HostedZoneName FnJoin('', [ Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.'])
123126
Name FnJoin('', [ hostname, '.', Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.' ])
124127
Type 'CNAME'

0 commit comments

Comments
 (0)