From 2406c4b3145887fb723dbe650127aeee8588ceeb Mon Sep 17 00:00:00 2001 From: stack72 Date: Wed, 16 Dec 2015 16:00:36 +0100 Subject: [PATCH] Adding a StateFunc for ToLower on subnet group name --- builtin/providers/aws/resource_aws_db_subnet_group.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_db_subnet_group.go b/builtin/providers/aws/resource_aws_db_subnet_group.go index 0127cfd48aaa..1bee0a6c2c90 100644 --- a/builtin/providers/aws/resource_aws_db_subnet_group.go +++ b/builtin/providers/aws/resource_aws_db_subnet_group.go @@ -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) { @@ -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 {