-
Notifications
You must be signed in to change notification settings - Fork 9k
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
ResourceId maxLength error when creating route53 alias on aws_vpc_endpoint dns_name #7557
Comments
…d arguments References: * #7557 * https://docs.aws.amazon.com/Route53/latest/APIReference/API_AliasTarget.html The Route53 API returns a confusing API error message when implementing an ALIAS record for Custom VPC Endpoints if the name and zone_id values are swapped: ``` --- FAIL: TestAccAWSRoute53Record_alias_vpcendpoint (363.09s) testing.go:531: Step 0, expected error: Error applying: 1 error occurred: * aws_route53_record.test: 1 error occurred: * aws_route53_record.test: [ERR]: Error building changeset: InvalidInput: Invalid XML ; cvc-maxLength-valid: Value 'vpce-0bd0cf7081a1a0f93-jtogpkxk.vpce-svc-0f1eac6867ad44720.us-west-2.vpce.amazonaws.com' with length = '87' is not facet-valid with respect to maxLength '32' for type 'ResourceId'. ``` This updates the resource to now report a validation error: ``` Error applying: 1 error occurred: * aws_route53_record.test: expected length of alias.0.zone_id to be in the range (1 - 32), got vpce-0ed0dbc5b2e181289-kr42z80r.vpce-svc-04a7ad6c6da00d525.us-west-2.vpce.amazonaws.com ``` Output from acceptance testing: ``` --- PASS: TestAccAWSRoute53Record_Alias_VpcEndpoint (423.77s) ```
Hi @jonathancolby-olx 👋Sorry you ran into trouble here. Looking at your configuration above, it appears the name = "${lookup(aws_vpc_endpoint.my_service_endpoint.dns_entry[0], "hosted_zone_id")}"
zone_id = "${lookup(aws_vpc_endpoint.my_service_endpoint.dns_entry[0], "dns_name")}" Switching them so they align should correct the error you're seeing: name = "${lookup(aws_vpc_endpoint.my_service_endpoint.dns_entry[0], "dns_name")}"
zone_id = "${lookup(aws_vpc_endpoint.my_service_endpoint.dns_entry[0], "hosted_zone_id")}" That said, the Terraform resource here could provide a slightly better message here before calling the Route53 API if we implemented length validation for both of those attributes. For example:
I have submitted the above validation as a pull request: #7606 Hope this helps! |
Validation has been merged and will release with version 1.60.0 of the Terraform AWS Provider, likely later today. |
This has been released in version 1.60.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Actual Behavior
The text was updated successfully, but these errors were encountered: