fix: Allow empty string as Route53 record name #420
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
Changes the way the Route53 record names are calculated, so they now align with the documentation. See #415 for further details on the background for this change.
Motivation and Context
If you want Atlantis to be hosted under the same FQDN as the Route53 zone under which it is registered, the Route53 record must be created with empty string (
""
) as its name. Unfortunately the current way the code works doesn't allow this (see #415): passing an empty string asvar.route53_record_name
would result incoalesce("", var.name)
which would result invar.name
. There was no way to explicitly specify empty string as the Route53 record name.This PR rewrites the logic so the name now falls back to
var.name
iffvar.route53_record_name == null
(which is the default). If the caller explicitly setsroute53_record_name = ""
, then that will be used instead as the Route53 record name.Note that this aligns with the way the documentation for the
route53_record_name
input is written. The previous behavior was a bug, that made the implemented behavior not act as the documentation describes. This PR simply fixes the bug.Fixes #415
Breaking Changes
Technically this is a breaking change; it changes what resources a given input spins up. This change is made to align it with the documentation, though, so there is no breaking change for documented behavior.
Whether you consider that a breaking change is up to the project maintainers.
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull requestThis has been tested locally to give the correct result. Since this is a niché use case (creating the Route53 record under the same name as the zone), I don't feel it relevant to add it to the
examples/*
documentation. That would likely just muddle the communication that the examples provide.I have only copied out the
locals
block into a local TF project, and verified that the result is as intended. That is, I haven't spun up the module, made the changes, and verified that there are no infrastructure changes. This PR is intended as the next step up from #415 - the cost involved in verifying that there are no changes is too big for me to validate it thoroughly. Feel free to reject this PR if that is unacceptable.