Merge pull request #3955 from cbusbey/db_subnet_spaces

allow spaces in db subnet name
This commit is contained in:
Radek Simko 2015-11-17 22:38:36 +00:00
commit 306046b82b
2 changed files with 12 additions and 4 deletions

View File

@ -31,7 +31,7 @@ func resourceAwsDbSubnetGroup() *schema.Resource {
value := v.(string)
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(

View File

@ -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}"]
}
`