Skip to content

Instantly share code, notes, and snippets.

@voke
Last active April 12, 2020 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voke/a1d58f91008ed8e94ca1319983491ec9 to your computer and use it in GitHub Desktop.
Save voke/a1d58f91008ed8e94ca1319983491ec9 to your computer and use it in GitHub Desktop.
# 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