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

[New Data Source]: aws_route53_zones Get list (!) of hosted zones #37465

Open
DJAlPee opened this issue May 13, 2024 · 1 comment · May be fixed by #17457
Open

[New Data Source]: aws_route53_zones Get list (!) of hosted zones #37465

DJAlPee opened this issue May 13, 2024 · 1 comment · May be fixed by #17457
Labels
new-data-source Introduces a new data source. service/route53 Issues and PRs that pertain to the route53 service.

Comments

@DJAlPee
Copy link

DJAlPee commented May 13, 2024

Description

I have several hosted zones in my AWS account and some zones are sub-zones e.g. example.com, app1.example.com, app2.example.com, etc., which are managed by an "external" stack.

If I want to to place a new application to my account, I want to select the "best fitting" zone, depending on the domain for the new application:

  • app1.example.com -> "" (empty) A record in app1.example.com
  • new.example.com -> "new" A record in example.com
  • very.deep.app2.example.com -> "very.deep" A record in example.com

I have already implented a some logic with terraform functions for selecting the zone, but for getting the list of hosted zones I'm using external provider, which just executes aws route53 list-hosted-zones --query HostedZones --output json (plus some hacky workaround by converting this output to base64, because this data source supports "key/value JSON", only)

It would be great, if I could use a native list data source for better stability and less external dependencies...
This new data source might be ideal for new contributers, because of existing similar list data sources and the "List" API is already being used by the existing aws_route53_zone(without trailing 's'):

resp, err := conn.ListHostedZonesWithContext(ctx, req)

Requested Resource(s) and/or Data Source(s)

  • aws_route53_zones

(Mind the trailing 's'!)

Potential Terraform Configuration

data "aws_route53_zones" "account_zones" {
  private_zone = false
}

References

Get some "inspiration" from similar data source:

AWS API:

Links to comparable data sources:

Would you like to implement a fix?

No

Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/route53 Issues and PRs that pertain to the route53 service. label May 13, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 13, 2024
@justinretzolk justinretzolk linked a pull request May 13, 2024 that will close this issue
@justinretzolk justinretzolk added new-data-source Introduces a new data source. and removed needs-triage Waiting for first response or review from a maintainer. labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-data-source Introduces a new data source. service/route53 Issues and PRs that pertain to the route53 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants