diff --git a/aws/validators.go b/aws/validators.go index 769a66a8393..3d064ea0de5 100644 --- a/aws/validators.go +++ b/aws/validators.go @@ -1717,7 +1717,15 @@ func validateCognitoUserPoolDomain(v interface{}, k string) (ws []string, errors } func validateDxConnectionBandWidth() schema.SchemaValidateFunc { - return validation.StringInSlice([]string{"1Gbps", "10Gbps"}, false) + return validation.StringInSlice([]string{ + "1Gbps", + "10Gbps", + "50Mbps", + "100Mbps", + "200Mbps", + "300Mbps", + "400Mbps", + "500Mbps"}, false) } func validateKmsKey(v interface{}, k string) (ws []string, errors []error) { diff --git a/aws/validators_test.go b/aws/validators_test.go index b4d656830e7..8ea201bfdd4 100644 --- a/aws/validators_test.go +++ b/aws/validators_test.go @@ -2979,3 +2979,38 @@ func TestValidateCloudFrontPublicKeyNamePrefix(t *testing.T) { } } } + +func TestValidateDxConnectionBandWidth(t *testing.T) { + validBandwidths := []string{ + "1Gbps", + "10Gbps", + "50Mbps", + "100Mbps", + "200Mbps", + "300Mbps", + "400Mbps", + "500Mbps", + } + for _, v := range validBandwidths { + _, errors := validateDxConnectionBandWidth()(v, "bandwidth") + if len(errors) != 0 { + t.Fatalf("%q should be a valid bandwidth: %q", v, errors) + } + } + + invalidBandwidths := []string{ + "1Tbps", + "100Gbps", + "10GBpS", + "42Mbps", + "0", + "???", + "a lot", + } + for _, v := range invalidBandwidths { + _, errors := validateDxConnectionBandWidth()(v, "bandwidth") + if len(errors) == 0 { + t.Fatalf("%q should be an invalid bandwidth", v) + } + } +}