Open JanStevens opened 4 months ago
You don't need to do that, you can use the pulumi aws provider which is provided out of the box:
async run() {
const zone = await aws.route53.getZone({ name: "your-domain.com" });
}
You don't even need to import anything, you should have it all autocompleted.
You don't need to do that, you can use the pulumi aws provider which is provided out of the box:
async run() { const zone = await aws.route53.getZone({ name: "your-domain.com" }); }
You don't even need to import anything, you should have it all autocompleted.
Thanks but does that also work when you want to look for a hosted zone without knowing the exact name? Example: I need to find the hosted zone for webhooks.api.staging.domain.com
where I might have a hosted zone for staging.domain.com
and domain.com
. In that case I want to use staging.domain.com
.
No I don't think it works like that. But for your use case, if you know the stage name and you are sure there is a Hosted Zone with that stage name, you can do:
const stage = $util.getStack()
const domainPrefix = stage === 'production' ? '' : `${stage}.`
const zone = await aws.route53.getZone({ name: `${domainPrefix}your-domain.com` });
Otherwise, if you indeed need to query for all hosted zones, I think you can use Pulumi to do async tasks, something like:
const result = $util.output((async () => {
// call to route53 using the sdk
// filter hosted zones and return the desired zone
return 'zone'
})())
No I don't think it works like that. But for your use case, if you know the stage name and you are sure there is a Hosted Zone with that stage name, you can do:
const stage = $util.getStack() const domainPrefix = stage === 'production' ? '' : `${stage}.` const zone = await aws.route53.getZone({ name: `${domainPrefix}your-domain.com` });
Otherwise, if you indeed need to query for all hosted zones, I think you can use Pulumi to do async tasks, something like:
const result = $util.output((async () => { // call to route53 using the sdk // filter hosted zones and return the desired zone return 'zone' })())
Yes that's basically what HostedZoneLookup does and why I made an issue 😅
Hi,
Having a helper that can resolve a provided domainName to a hosted zone ID is extremely helpful, so it would be great to expose this.
Right now I have to import from
And install 2 additional packages: