sous-chefs / aws

Development repository for the aws cookbook
https://supermarket.chef.io/cookbooks/aws
Apache License 2.0
612 stars 554 forks source link

route53_record support for multiple zone_id's #403

Closed haidangwa closed 4 years ago

haidangwa commented 4 years ago

Cookbook version

8.2.0

Chef-client version

15.8.32

Platform Details

Redhat 8

Scenario:

We have two route53 hosted zones. One zone contains only IP addresses that are internet routable. We have a second zone that contains only private IP addresses. We have a use case where a chef node needs to update both zones. The two zones are identical in name (e.g., hosted zone name for internal view and external view are both x.y.z.. The only difference is the Zone ID and the IP addresses passed by the value property. This EC2 node has an EIP and a private IP address assigned to it.

Steps to Reproduce:

   domain_name = 'x.y.z.'
   dns_values = {
       'ZONEID1' => '10.3.3.3',
       'ZONEID2' => '32.208.191.2'
   } # these are fake, duh

   dns_values.each do |zone, ip|
        route53_record "#{hostname}.#{domain_name}" do
          value ip
          type 'A'
          ttl 300
          zone_id zone
          overwrite true
          action :create
        end
  end

We know about resource cloning and the problem with that, so obviously, the above code will throw an error. However, we can find no way that a different resource name can be given. I think if there was a record_name property added to this resource that would default to the resource name, it would solve our problem.

Expected Result:

Support a way to update similar records in both zones

Actual Result:

today, we could end up with cloned chef resources instead.

         aws_route53_record[ingest.x.y.z]
         aws_route53_record[ingest.x.y.z]
haidangwa commented 4 years ago

This issue has been closed with the merge of #415