1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

AWS DNS - support newer DNS hosted zone IDs for dualstack ELBs

This commit is contained in:
Matthew O'Riordan 2016-06-21 15:28:57 +01:00
parent 8a4a1e2c7e
commit e313179b08

View file

@ -3,7 +3,13 @@ module Fog
class AWS
def self.hosted_zone_for_alias_target(dns_name)
Hash[elb_hosted_zone_mapping.select { |k, _|
hosted_zones = if dns_name.match(/^dualstack\./)
elb_dualstack_hosted_zone_mapping
else
elb_hosted_zone_mapping
end
Hash[hosted_zones.select { |k, _|
dns_name =~ /\A.+\.#{k}\.elb\.amazonaws\.com\.?\z/
}].values.last
end
@ -22,6 +28,21 @@ module Fog
}
end
# See https://forums.aws.amazon.com/message.jspa?messageID=612414
def self.elb_dualstack_hosted_zone_mapping
@elb_dualstack_hosted_zone_mapping ||= {
"ap-northeast-1" => "Z14GRHDCWA56QT",
"ap-southeast-1" => "Z1LMS91P8CMLE5",
"ap-southeast-2" => "Z1GM3OXH4ZPM65",
"eu-central-1" => "Z215JYRZR1TBD5",
"eu-west-1" => "Z32O12XQLNTSW2",
"sa-east-1" => "Z2P70J7HTTTPLU",
"us-east-1" => "Z35SXDOTRQ7X7K",
"us-west-1" => "Z368ELLRRE2KJ0",
"us-west-2" => "Z1H1FL5HABSF5",
}
end
# Returns the xml request for a given changeset
def self.change_resource_record_sets_data(zone_id, change_batch, version, options = {})
# AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use