sst / ion

SST v3
https://sst.dev
MIT License
2.14k stars 250 forks source link

HostedZoneLookup does not return the most applicable zone #1249

Open jjongsma-provi opened 1 week ago

jjongsma-provi commented 1 week ago

I've created a separate subdomain zone (i.e. app.domain.com) in Route 53 since we need to dynamically create customer-branded subdomains for the app and want to limit IAM access to a smaller DNS zone. The main, non-branded app runs on app.domain.com. When I deploy with SST, HostedZoneLookup returns the top level domain zone (for domain.com) rather than the subdomain zone which would be a closer match.

Result: SST adds A and AAAA records to the domain.com zone, but since it is delegating DNS to the app.domain.com zone, name resolution fails. It should probably be adding apex records to the app.domain.com subdomain zone since it's the closest match.

An alternative of course would be to explicitly specify sst.aws.dns() for the domain, but would be nicer if it was automatic (and using that poses problems for us at the moment because we're defining stage config outside of $config where sst isn't available globally yet.)

jayair commented 1 week ago

Can you share some snippets of what you are doing here?

SST adds A and AAAA records to the domain.com zone, but since it is delegating DNS to the app.domain.com zone

And for this, what do you mean you can't access $config?

because we're defining stage config outside of $config where sst isn't available globally yet