Last active
April 12, 2020 15:05
-
-
Save voke/a1d58f91008ed8e94ca1319983491ec9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It can take up to several hours for ACM to validate the domain name and issue the certificate | |
# so better be sure it's working. | |
require 'csv' | |
require 'resolv' | |
res = open("DNS_Configuration.csv") # Export DNS configuration to a file | |
row = CSV.new(res.read, headers: true).first | |
expected = row["Record Value"].delete_suffix('.') | |
url = row["Record Name"].delete_suffix('.') | |
puts "LOOKUP: #{url}" | |
record = Resolv::DNS.open do |dns| | |
dns.getresource(url, Resolv::DNS::Resource::IN::CNAME) | |
end | |
value = record.name.to_s | |
if value == expected | |
puts "Successful! Let's wait for AWS to validate it!" | |
else | |
puts "Failed! Expected #{value.inspect} to be #{expected.inspect}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment