feat: certificate validation with multiple Route 53 zones #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The proposed change is based on what I think is a simple idea: taking as input a mapping from domain names to publicly hosted Route 53 zone ids, for every record necessary for validation, find the best matching zone that can contain the validation record and create the record into that zone. The best matching zone is found by iterating over all the domain names mapped to hosted zones, from the longest one to the shortest one, and checking if the current fully-qualified domain name is a parent of the fully-qualified name in
resource_record_name
.The
locals
section becomes bigger and maybe too verbose, but I'll try to explain the changes in a little more details:local.distinct_domain_names
andlocal.validation_domains
. One subset contains the items that will be used to create the validation records, one subset contains the items for which validation records cannot be created by the module because they cannot be hosted in the zones given as inputlocals
used as module outputs are changed slightly to have normalized typesAn example is added too: it shows an ACM certificate with requires validation records in three zones. In the set of three zones, one zone has a subdomain delegation to another zone.
There are no documentation changes yet. I would like to see first if the idea is in the good direction.
Motivation and Context
There is high interest in creating ACM certificates with multiple domains in them (#21). My particular use-case is multiple domains ACM certificates for using on CloudFront distributions.
This change or the idea from this change, if accepted, would allow the module to cover more use-cases:
domain_one
,*.domain_one
,domain_two
,*.domain_two
, wheredomain_one
is hosted in one Route 53 zone anddomain_two
is hosted in another Route 53 zoneexample.com
,my.example.com
,a.little.deep.my.example.com
, withexample.com
hosted in one Route 53 zone and delegatingmy.example.com
to another Route 53 hosted zonewait_for_validation
to false and using thevalidation_domains_without_matching_zone
output , will be able to create the records at the third-party provides and complete the validation. For example: domainsexample.com
andexample.org
in the certificate, domainexample.com
hosted in a Route 53 zone, domainexample.org
hosted somewhere else.Breaking Changes
The change adds a new input and new outputs and the new logic is applied when using the new input variable.
How Has This Been Tested?
examples/*
projects