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

Don't mangle DNS aliases: Trim{Prefix,Suffix} not Trim{Left,Right}. #3187

Merged
merged 1 commit into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions aws/resource_aws_route53_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,12 +900,9 @@ func nilString(s string) *string {
}

func normalizeAwsAliasName(alias interface{}) string {
input := alias.(string)
output := strings.ToLower(input)
if strings.HasPrefix(output, "dualstack.") {
output = strings.TrimLeft(output, "dualstack.")
}
return strings.TrimRight(output, ".")
input := strings.ToLower(alias.(string))
output := strings.TrimPrefix(input, "dualstack.")
return strings.TrimSuffix(output, ".")
}

func parseRecordId(id string) [4]string {
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_route53_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func TestNormalizeAwsAliasName(t *testing.T) {
{"www.nonexample.com", "www.nonexample.com"},
{"www.nonexample.com.", "www.nonexample.com"},
{"dualstack.name-123456789.region.elb.amazonaws.com", "name-123456789.region.elb.amazonaws.com"},
{"dualstack.test-987654321.region.elb.amazonaws.com", "test-987654321.region.elb.amazonaws.com"},
{"dualstacktest.com", "dualstacktest.com"},
{"NAME-123456789.region.elb.amazonaws.com", "name-123456789.region.elb.amazonaws.com"},
}

Expand Down