Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow hosted zone name to be passed in separately #119

Merged

Conversation

tonnenpinguin
Copy link
Contributor

@tonnenpinguin tonnenpinguin commented Aug 14, 2024

Description

Allow users to explicitly pass the name of the hosted zone they would like the domain to be created in.

Motivation and Context

This allows for use cases where the hosted zone is delegated from another account (e.g. team-abc.acme.com).
Within that hosted zone you might want to create another domain (api.team-abc.acme.com). This currently isn't possible because the module expects a hosted zone with the name as passed in var.domain_name to be present.

Breaking Changes

None, if the parameter isn't passed we just look up the hosted zone based on the stripped_domain_name as before.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have tested and validated the changes against my own project that was failing with the same error as laid out in the issue linked above.
  • I have executed pre-commit run -a on my pull request

variables.tf Outdated Show resolved Hide resolved
@tonnenpinguin tonnenpinguin changed the title feat: allow hosted zone name to be passed in separately feat: Allow hosted zone name to be passed in separately Aug 14, 2024
Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost perfect. Minor comments.

main.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
examples/complete-http/main.tf Outdated Show resolved Hide resolved
examples/complete-http/main.tf Outdated Show resolved Hide resolved
examples/complete-http/main.tf Outdated Show resolved Hide resolved
@tonnenpinguin
Copy link
Contributor Author

tonnenpinguin commented Aug 15, 2024

Thanks for the quick feedback @antonbabenko and @bryantbiggs! 🙂
I updated my PR accordingly

@antonbabenko antonbabenko merged commit bcd2fdb into terraform-aws-modules:master Aug 26, 2024
9 checks passed
antonbabenko pushed a commit that referenced this pull request Aug 26, 2024
## [5.2.0](v5.1.3...v5.2.0) (2024-08-26)

### Features

* Allow hosted zone name to be passed in separately ([#119](#119)) ([bcd2fdb](bcd2fdb))
@antonbabenko
Copy link
Member

This PR is included in version 5.2.0 🎉

@@ -134,7 +134,7 @@ locals {
data "aws_route53_zone" "this" {
count = local.create_domain_name && var.create_domain_records ? 1 : 0

name = local.stripped_domain_name
name = coalesce(var.hosted_zone_name, local.stripped_domain_name)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt allow null in both parameters.. breaks the previous API

Copy link
Contributor Author

@tonnenpinguin tonnenpinguin Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's accurate.
1.) A lookup without name doesn't make sense and would fail anyway(I guess?)
2.) local.stripped_domain_name cannot be null since we would fail a couple lines up already when calling replace

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom domain name setup creates the wrong cert and mapping
5 participants