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

Route 53 record ID parse fails when set ID contains underscores #13457

Closed
brandon-dd opened this issue May 21, 2020 · 1 comment · Fixed by #13453
Closed

Route 53 record ID parse fails when set ID contains underscores #13457

brandon-dd opened this issue May 21, 2020 · 1 comment · Fixed by #13453
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service.

Comments

@brandon-dd
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

TF version 0.12.25
AWS provider version 2.62.0

Affected Resource(s)

  • aws_route53_record

Failing Test

To see the failure, edit this section of the test:

https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_route53_record_test.go#L84-L88

to verify parsing of this string, too:

{"ABCDEF_test.notexample.com_A_set_id_with_underscores", "ABCDEF", "test.notexample.com", "A", "set_id_with_underscores"}

and you'll see this in the error output:

--- FAIL: TestParseRecordId (0.00s)
    resource_aws_route53_record_test.go:98: input: ABCDEF_test.notexample.com_A_set_id_with_underscores
        output: test.notexample.com_A_set_id
        expected:test.notexample.com

Expected Behavior

Not sure about what the desired behavior should be here, which is why I didn't open a PR. The culprit is this line, where it finds the last underscore in the rest of the string:

https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_route53_record.go#L949

Of course, then, this gives the wrong result when the set ID contains an underscores. But, that means that underscores can come before or after the resource type (A, CNAME, etc) and thus parsing the string correctly becomes a significantly harder problem -- wasn't sure how you guys wanted to approach this.

Impact

For us, this caused the inability to import Route 53 CNAME records whose set ID contained underscores, giving the error:

Error: InvalidInput: 1 validation error detected: Value 'foo' at 'startRecordType' failed to satisfy constraint: Member must satisfy enum value set: [AAAA, A, CAA, NS, SOA, SPF, MX, PTR, CNAME, TXT, SRV, NAPTR]
	status code: 400, request id: 5bcffcd3-87b5-44a9-a6f6-3d2075d1168f

(with foo being the second-to-last underscored portion of the set ID, instead of the actual record type, which was CNAME)

@ghost ghost added the service/route53 Issues and PRs that pertain to the route53 service. label May 21, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 21, 2020
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 21, 2020
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service.
Projects
None yet
2 participants