-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
provider/aws: aws_route53_record import error processing #11603
Conversation
Fixes: #11549 When a user passes the wrong argument to a route53_record import, they got a crash. This was because we expected the ID to parse correctly. The crash looked like this: ``` % terraform import aws_route53_record.import1 mike.westredd.com aws_route53_record.import1: Importing from ID "mike.westredd.com"... aws_route53_record.import1: Import complete! Imported aws_route53_record (ID: mike.westredd.com) aws_route53_record.import1: Refreshing state... (ID: mike.westredd.com) Error importing: 1 error(s) occurred: * aws_route53_record.import1: unexpected EOF panic: runtime error: index out of range ``` Rather than throwing a panic to the user, we should present them with a more useful message that tells them what the error is: ``` % terraform import aws_route53_record.import mike.westredd.com aws_route53_record.import: Importing from ID "mike.westredd.com"... aws_route53_record.import: Import complete! Imported aws_route53_record (ID: mike.westredd.com) aws_route53_record.import: Refreshing state... (ID: mike.westredd.com) Error importing: 1 error(s) occurred: * aws_route53_record.import: Error Importing aws_route_53 record. Please make sure the record ID is in the form ZONEID_RECORDNAME_TYPE (i.e. Z4KAPRWWNC7JR_dev_A ``` At least they can work out what the problem is in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Fixes: #11549 When a user passes the wrong argument to a route53_record import, they got a crash. This was because we expected the ID to parse correctly. The crash looked like this: ``` % terraform import aws_route53_record.import1 mike.westredd.com aws_route53_record.import1: Importing from ID "mike.westredd.com"... aws_route53_record.import1: Import complete! Imported aws_route53_record (ID: mike.westredd.com) aws_route53_record.import1: Refreshing state... (ID: mike.westredd.com) Error importing: 1 error(s) occurred: * aws_route53_record.import1: unexpected EOF panic: runtime error: index out of range ``` Rather than throwing a panic to the user, we should present them with a more useful message that tells them what the error is: ``` % terraform import aws_route53_record.import mike.westredd.com aws_route53_record.import: Importing from ID "mike.westredd.com"... aws_route53_record.import: Import complete! Imported aws_route53_record (ID: mike.westredd.com) aws_route53_record.import: Refreshing state... (ID: mike.westredd.com) Error importing: 1 error(s) occurred: * aws_route53_record.import: Error Importing aws_route_53 record. Please make sure the record ID is in the form ZONEID_RECORDNAME_TYPE (i.e. Z4KAPRWWNC7JR_dev_A ``` At least they can work out what the problem is in this case
…1603) Fixes: hashicorp#11549 When a user passes the wrong argument to a route53_record import, they got a crash. This was because we expected the ID to parse correctly. The crash looked like this: ``` % terraform import aws_route53_record.import1 mike.westredd.com aws_route53_record.import1: Importing from ID "mike.westredd.com"... aws_route53_record.import1: Import complete! Imported aws_route53_record (ID: mike.westredd.com) aws_route53_record.import1: Refreshing state... (ID: mike.westredd.com) Error importing: 1 error(s) occurred: * aws_route53_record.import1: unexpected EOF panic: runtime error: index out of range ``` Rather than throwing a panic to the user, we should present them with a more useful message that tells them what the error is: ``` % terraform import aws_route53_record.import mike.westredd.com aws_route53_record.import: Importing from ID "mike.westredd.com"... aws_route53_record.import: Import complete! Imported aws_route53_record (ID: mike.westredd.com) aws_route53_record.import: Refreshing state... (ID: mike.westredd.com) Error importing: 1 error(s) occurred: * aws_route53_record.import: Error Importing aws_route_53 record. Please make sure the record ID is in the form ZONEID_RECORDNAME_TYPE (i.e. Z4KAPRWWNC7JR_dev_A ``` At least they can work out what the problem is in this case
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes: #11549
When a user passes the wrong argument to a route53_record import, they
got a crash. This was because we expected the ID to parse correctly. The
crash looked like this:
Rather than throwing a panic to the user, we should present them with a more useful message that tells them what the error is:
At least they can work out what the problem is in this case