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

resource/aws_route53_record: Add validation for alias name and zone_id arguments #7606

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

bflad
Copy link
Member

@bflad bflad commented Feb 19, 2019

Closes #7557

References:

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)

…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)
```
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/route53 Issues and PRs that pertain to the route53 service. labels Feb 19, 2019
@ghost ghost added size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Feb 19, 2019
@jonathancolby-olx
Copy link

jonathancolby-olx commented Feb 20, 2019

@bflad - Thank you for taking the time to review my issue. Indeed this is a user-error. Thanks for pointing out the problem and creating the validation!

@bflad bflad requested a review from a team February 20, 2019 19:33
@bflad bflad added this to the v1.60.0 milestone Feb 21, 2019
@bflad bflad merged commit b9dba0b into master Feb 21, 2019
@bflad bflad deleted the f-aws_route53_record-alias-validation branch February 21, 2019 19:45
bflad added a commit that referenced this pull request Feb 21, 2019
@bflad
Copy link
Member Author

bflad commented Feb 22, 2019

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.

@ghost
Copy link

ghost commented Mar 31, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/route53 Issues and PRs that pertain to the route53 service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResourceId maxLength error when creating route53 alias on aws_vpc_endpoint dns_name
3 participants