Skip to content

Commit

Permalink
Adding a StateFunc for ToLower on subnet group name
Browse files Browse the repository at this point in the history
  • Loading branch information
stack72 committed Dec 16, 2015
1 parent 3365cd2 commit 2406c4b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions builtin/providers/aws/resource_aws_db_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func resourceAwsDbSubnetGroup() *schema.Resource {
Type: schema.TypeString,
ForceNew: true,
Required: true,
StateFunc: func(v interface{}) string {
value := v.(string)
return strings.ToLower(value)
},
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if !regexp.MustCompile(`^[ .0-9A-Za-z-_]+$`).MatchString(value) {
Expand Down Expand Up @@ -131,8 +135,8 @@ func resourceAwsDbSubnetGroupRead(d *schema.ResourceData, meta interface{}) erro
return fmt.Errorf("Unable to find DB Subnet Group: %#v", describeResp.DBSubnetGroups)
}

d.Set("name", d.Id())
d.Set("description", *subnetGroup.DBSubnetGroupDescription)
d.Set("name", subnetGroup.DBSubnetGroupName)
d.Set("description", subnetGroup.DBSubnetGroupDescription)

subnets := make([]string, 0, len(subnetGroup.Subnets))
for _, s := range subnetGroup.Subnets {
Expand Down

0 comments on commit 2406c4b

Please sign in to comment.