Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/aws: DB subnet group description modification #5921

Merged
merged 3 commits into from
Mar 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions builtin/providers/aws/resource_aws_db_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func resourceAwsDbSubnetGroup() *schema.Resource {
"description": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"subnet_ids": &schema.Schema{
Expand Down Expand Up @@ -153,7 +152,7 @@ func resourceAwsDbSubnetGroupRead(d *schema.ResourceData, meta interface{}) erro

func resourceAwsDbSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).rdsconn
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)
Expand All @@ -166,8 +165,9 @@ func resourceAwsDbSubnetGroupUpdate(d *schema.ResourceData, meta interface{}) er
}

_, err := conn.ModifyDBSubnetGroup(&rds.ModifyDBSubnetGroupInput{
DBSubnetGroupName: aws.String(d.Id()),
SubnetIds: sIds,
DBSubnetGroupName: aws.String(d.Id()),
DBSubnetGroupDescription: aws.String(d.Get("description").(string)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ColinHebert

This will only actually be called if there is a chance in subnet_ids

This update will need to be reworked. I will manually make those changes on the PR and test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, added the HasChange on description as well. In the case where the subnet_ids do not change but description does change, the GetChange method is expected to still return the desired value (as it hasn't changed) for the update.

SubnetIds: sIds,
})

if err != nil {
Expand Down