Merge pull request #3955 from cbusbey/db_subnet_spaces
allow spaces in db subnet name
This commit is contained in:
commit
306046b82b
|
@ -29,9 +29,9 @@ func resourceAwsDbSubnetGroup() *schema.Resource {
|
|||
Required: true,
|
||||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
|
||||
value := v.(string)
|
||||
if !regexp.MustCompile(`^[.0-9A-Za-z-_]+$`).MatchString(value) {
|
||||
if !regexp.MustCompile(`^[ .0-9A-Za-z-_]+$`).MatchString(value) {
|
||||
errors = append(errors, fmt.Errorf(
|
||||
"only alphanumeric characters, hyphens, underscores, and periods allowed in %q", k))
|
||||
"only alphanumeric characters, hyphens, underscores, periods, and spaces allowed in %q", k))
|
||||
}
|
||||
if len(value) > 255 {
|
||||
errors = append(errors, fmt.Errorf(
|
||||
|
|
|
@ -51,12 +51,14 @@ func TestAccAWSDBSubnetGroup_withUndocumentedCharacters(t *testing.T) {
|
|||
CheckDestroy: testAccCheckDBSubnetGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccDBSubnetGroupConfig_withUnderscoresAndPeriods,
|
||||
Config: testAccDBSubnetGroupConfig_withUnderscoresAndPeriodsAndSpaces,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckDBSubnetGroupExists(
|
||||
"aws_db_subnet_group.underscores", &v),
|
||||
testAccCheckDBSubnetGroupExists(
|
||||
"aws_db_subnet_group.periods", &v),
|
||||
testAccCheckDBSubnetGroupExists(
|
||||
"aws_db_subnet_group.spaces", &v),
|
||||
testCheck,
|
||||
),
|
||||
},
|
||||
|
@ -156,7 +158,7 @@ resource "aws_db_subnet_group" "foo" {
|
|||
}
|
||||
`
|
||||
|
||||
const testAccDBSubnetGroupConfig_withUnderscoresAndPeriods = `
|
||||
const testAccDBSubnetGroupConfig_withUnderscoresAndPeriodsAndSpaces = `
|
||||
resource "aws_vpc" "main" {
|
||||
cidr_block = "192.168.0.0/16"
|
||||
}
|
||||
|
@ -184,4 +186,10 @@ resource "aws_db_subnet_group" "periods" {
|
|||
description = "Our main group of subnets"
|
||||
subnet_ids = ["${aws_subnet.frontend.id}", "${aws_subnet.backend.id}"]
|
||||
}
|
||||
|
||||
resource "aws_db_subnet_group" "spaces" {
|
||||
name = "with spaces"
|
||||
description = "Our main group of subnets"
|
||||
subnet_ids = ["${aws_subnet.frontend.id}", "${aws_subnet.backend.id}"]
|
||||
}
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue