Skip to content

Commit

Permalink
Merge pull request #18 from Samseppiol/master
Browse files Browse the repository at this point in the history
Convert component to use new dns convention
  • Loading branch information
aaronwalker committed Mar 26, 2020
2 parents 0c3ba51 + 9351a82 commit d1d0a6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aurora-mysql.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@

Route53_RecordSet(:DBClusterReaderRecord) {
Condition(:EnableReader)
HostedZoneName FnJoin('', [ Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.'])
Name FnJoin('', [ external_parameters[:hostname_read_endpoint], '.', Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.' ])
HostedZoneName FnSub("#{external_parameters[:dns_format]}.")
Name FnSub("#{external_parameters[:hostname_read_endpoint]}.#{external_parameters[:dns_format]}.")
Type 'CNAME'
TTL '60'
ResourceRecords [ FnGetAtt('DBCluster','ReadEndpoint.Address') ]
}
end

Route53_RecordSet(:DBHostRecord) {
HostedZoneName FnJoin('', [ Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.'])
Name FnJoin('', [ external_parameters[:hostname], '.', Ref('EnvironmentName'), '.', Ref('DnsDomain'), '.' ])
HostedZoneName FnSub("#{external_parameters[:dns_format]}.")
Name FnSub("#{external_parameters[:hostname]}.#{external_parameters[:dns_format]}.")
Type 'CNAME'
TTL '60'
ResourceRecords [ FnGetAtt('DBCluster','Endpoint.Address') ]
Expand Down
1 change: 1 addition & 0 deletions aurora-mysql.config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dns_format: ${EnvironmentName}.${DnsDomain}
maximum_availability_zones: 5

hostname: aurora2
Expand Down
6 changes: 6 additions & 0 deletions tests/dns_format.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test_metadata:
type: config
name: dns format
description: Converts component to use dns format config

dns_format: ${EnvironmentName}.${DnsDomain}

0 comments on commit d1d0a6c

Please sign in to comment.