-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Issue when using "route53.HostedZone.fromHostedZoneId" Method #8406
Comments
What you're currently doing is fine. I do believe we can better document this as it has come up before as a point of confusion for users.
It takes the attributes and performs an API call to determine which exact HostedZone is deployed and updates its behavior accordingly. |
Understood, thank you for the explanations ! Definitely, I've gotten used to use About cdk.context.json, do you know any reasons why the file can't be populated anymore ? |
can you expand on that? I need a little more information to dig into that. some questions that pop into my mind:
|
Sorry, it's not our purpose but yes, it was polpulated before and not now.
vpc-provider:account 3 times (for my 3 accounts); that's all. But, don't really nead that file, what is his main use ? |
@Cloudrage sorry for the late reply i missed your question here. The primary purpose of the runtime context is to cache information from your AWS account (such as availability zones). This avoids unexpected changes to your deployments. In your case, the context is populated so that the availability zones that are available and valid for the regions you are deploying are cached. If the you can learn more about runtime context here. |
I'm resolving this issue as I don't believe further action is required. Feel free to re-open / ask questions if anything has been left unanswered! |
Thanks @shivlaks for your time & explanations ! |
What if you want to create an ARecord on an existing HostedZone on another account because its the DNS so the hosted zone is not created in any of your stacks? |
@kgunny , I've the same use case and I've to import the HostedZone from the other account : These one are stored in a JSON var file to be retrieved by the Stack with a tryGetContext. It's not a perfect way, I don't like that too (globally because CDK can't rertieve natively resources between accounts); but it's the most simpliest way I've found. |
Thanks @Cloudrage will experiment and see how I go. |
@kgunny Hello, I just hit your error :
I'm trying to create a record for a cloudfront distribution. Everything is in the same region except the certificate (it's required to be in us-east-1 by cloudfront). Also I created the certificate and the hosted zone outside of CDK. I retrieve there infos using ssm. Did you solve your issue? I tried to solve it the last 2 hours with nice people on cdk's Slack without finding a solution. Here is my stacks involved and the error log : https://gist.github.com/jgoux/9f26a27137a511e278f8fe01e01f5e3f#file-cloudfront-ts ** EDIT ** : Problem solved! 🎊 |
Sorry no we are still not able to use certificates across accounts/regions, even with latest CDK and bootstrapping. And the certificate still needs to be hosted in us-east-1. |
@jgoux Hi, I'm facing the same issue as yours during CDK version migration (from 1.45.0 to 1.110.0)
I also resolved it by moving the alias record from route53 stack to cloudfront stack (thanks!) |
@danny-xx Why is your record destroyed and re-created? If it's the exact same I guess CDK should diff it. 🤔 |
@jgoux Thanks for the quick reply! |
I've encountered this issue just now and I believe this should be reopened @shivlaks Why would the following call (I'm using Python CDK v1.114.0): Result in: This doesn't make sense... I didn't pass the function a zone name and in fact the function doesn't even accept a zone name... This is either poor API design, or a bug - calling this expected behavior seems like a stretch to me. |
I agree this is an issue. If I pass the zoneId (which I did) I should not be getting an error for the name? |
I agree with other here, this is a bug, either in the documentation or implementation..
As such, I would expect it to work, instead of complaining about an argument which I did not pass, and which it does not accept. |
You will get an error for Seeing as this is causing lots of confusion, we can improve the error message. I'm also working on improving the documentation related to how importing resources in CDK works in general, which should also help to reduce confusion surrounding these types of errors. Sidenote - I've seen this in both related threads
This is incorrect. only |
Thanks for taking some action on this @peterwoodworth , it's really appreciated. Are you also aware of the conversation on #3558 ? There's further discussion there from a number of community members around the expectation that |
The only methods we have which actually perform lookups to your AWS account are usually denoted with This is one of the most frequent sources of confusion for CDK users - lots of users expect methods like
I agree that dynamically retrieving the |
As a quite new user of CDK (that are not aware about its internals), it would make sense to me to have After reading through this and related issues, I can finally understand the error I'm getting, but as has been pointed out, you should not have to google the error and read through a bunch of github threads in order to understand why you get a strange error. |
fixes #8406 ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](/~https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](/~https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](/~https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
fixes aws#8406 ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](/~https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](/~https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](/~https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Reproduction Steps
When trying to import an HostedZone with :
route53.HostedZone.fromHostedZoneId(this, 'MyHostedZone', 'ID123456789')
Error Log
I've that error when launching the Stack :
HostedZone.fromHostedZoneId doesn't support "zoneName"
Environment
Other
So, I've imported that way :
route53.HostedZone.fromHostedZoneAttributes(this, 'R53Domain', {hostedZoneId: 'MyID123456789', zoneName: 'Toto'})
What's wrong with fromHostedZoneId Method ?
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: