Merge branch 'pr-4969'
* pr-4969: provider/aws: All security group mods on first run when restoring from snapshot
This commit is contained in:
commit
8b4a366b43
|
@ -369,12 +369,20 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
|
||||||
opts.StorageType = aws.String(attr.(string))
|
opts.StorageType = aws.String(attr.(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("[DEBUG] DB Instance restore from snapshot configuration: %s", opts)
|
||||||
_, err := conn.RestoreDBInstanceFromDBSnapshot(&opts)
|
_, err := conn.RestoreDBInstanceFromDBSnapshot(&opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error creating DB Instance: %s", err)
|
return fmt.Errorf("Error creating DB Instance: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sgUpdate bool
|
||||||
if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 {
|
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 {
|
||||||
log.Printf("[INFO] DB is restoring from snapshot with default security, but custom security should be set, will now update after snapshot is restored!")
|
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
|
// wait for instance to get up and then modify security
|
||||||
|
|
Loading…
Reference in New Issue