From 96f1aff69365a5ff2d2f56f8f9260e495992d9b5 Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Fri, 2 Sep 2016 09:51:37 +0530 Subject: [PATCH] Update rds password if provided while creating from snapshot --- builtin/providers/aws/resource_aws_db_instance.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index c2b2317f7..7ef99c57f 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -432,13 +432,19 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error } var sgUpdate bool + var passwordUpdate bool + + if _, ok := d.GetOk("password"); ok { + passwordUpdate = true + } + if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 { sgUpdate = true } if attr := d.Get("security_group_names").(*schema.Set); attr.Len() > 0 { sgUpdate = true } - if sgUpdate { + if sgUpdate || passwordUpdate { log.Printf("[INFO] DB is restoring from snapshot with default security, but custom security should be set, will now update after snapshot is restored!") // wait for instance to get up and then modify security