diff --git a/builtin/providers/aws/resource_aws_redshift_subnet_group.go b/builtin/providers/aws/resource_aws_redshift_subnet_group.go index 5b119ed7f..c4f8697f5 100644 --- a/builtin/providers/aws/resource_aws_redshift_subnet_group.go +++ b/builtin/providers/aws/resource_aws_redshift_subnet_group.go @@ -103,7 +103,7 @@ func resourceAwsRedshiftSubnetGroupRead(d *schema.ResourceData, meta interface{} func resourceAwsRedshiftSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).redshiftconn - if d.HasChange("subnet_ids") { + if d.HasChange("subnet_ids") || d.HasChange("description") { _, n := d.GetChange("subnet_ids") if n == nil { n = new(schema.Set) @@ -117,6 +117,7 @@ func resourceAwsRedshiftSubnetGroupUpdate(d *schema.ResourceData, meta interface _, err := conn.ModifyClusterSubnetGroup(&redshift.ModifyClusterSubnetGroupInput{ ClusterSubnetGroupName: aws.String(d.Id()), + Description: aws.String(d.Get("description").(string)), SubnetIds: sIds, }) diff --git a/builtin/providers/aws/resource_aws_redshift_subnet_group_test.go b/builtin/providers/aws/resource_aws_redshift_subnet_group_test.go index 282fc15e4..03ee1e154 100644 --- a/builtin/providers/aws/resource_aws_redshift_subnet_group_test.go +++ b/builtin/providers/aws/resource_aws_redshift_subnet_group_test.go @@ -33,6 +33,35 @@ func TestAccAWSRedshiftSubnetGroup_basic(t *testing.T) { }) } +func TestAccAWSRedshiftSubnetGroup_updateDescription(t *testing.T) { + var v redshift.ClusterSubnetGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckRedshiftSubnetGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccRedshiftSubnetGroupConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckRedshiftSubnetGroupExists("aws_redshift_subnet_group.foo", &v), + resource.TestCheckResourceAttr( + "aws_redshift_subnet_group.foo", "description", "foo description"), + ), + }, + + resource.TestStep{ + Config: testAccRedshiftSubnetGroup_updateDescription, + Check: resource.ComposeTestCheckFunc( + testAccCheckRedshiftSubnetGroupExists("aws_redshift_subnet_group.foo", &v), + resource.TestCheckResourceAttr( + "aws_redshift_subnet_group.foo", "description", "foo description updated"), + ), + }, + }, + }) +} + func TestAccAWSRedshiftSubnetGroup_updateSubnetIds(t *testing.T) { var v redshift.ClusterSubnetGroup @@ -177,6 +206,37 @@ resource "aws_subnet" "bar" { resource "aws_redshift_subnet_group" "foo" { name = "foo" + description = "foo description" + subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"] +} +` + +const testAccRedshiftSubnetGroup_updateDescription = ` +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_subnet" "foo" { + cidr_block = "10.1.1.0/24" + availability_zone = "us-west-2a" + vpc_id = "${aws_vpc.foo.id}" + tags { + Name = "tf-dbsubnet-test-1" + } +} + +resource "aws_subnet" "bar" { + cidr_block = "10.1.2.0/24" + availability_zone = "us-west-2b" + vpc_id = "${aws_vpc.foo.id}" + tags { + Name = "tf-dbsubnet-test-2" + } +} + +resource "aws_redshift_subnet_group" "foo" { + name = "foo" + description = "foo description updated" subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"] } `