Fix bug: route53_zone import saves name with trailing . in state causing plan to detect a change and try to recreate the zone #3982
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.
When creating a
aws_route53_zone
in terraform, you define the name of the domain as in the documentation:However, when importing an existing
aws_route53_zone
, terraform is using the name returned by AWS which has a trailing "." in the end of it which is the name displayed in the web console. The name with the trailing "." gets saved into your state causing an inconsistency, so if you run a plan right after importing the zone you get something like:due to the difference in name. This PR fixes it buy removing the trailing "." when reading the zone name during an import. I also removed it from the data used in the acceptance tests since it doesn't match the example suggested in the docs.