Changing the db_instance to throw an error is a final snapshot is required but yet no identified is given

This commit is contained in:
stack72 2015-11-11 16:39:24 +00:00
parent 5796b13373
commit 6082e3e732
1 changed files with 6 additions and 2 deletions

View File

@ -628,8 +628,12 @@ func resourceAwsDbInstanceDelete(d *schema.ResourceData, meta interface{}) error
skipFinalSnapshot := d.Get("skip_final_snapshot").(bool)
opts.SkipFinalSnapshot = aws.Bool(skipFinalSnapshot)
if name, present := d.GetOk("final_snapshot_identifier"); present && !skipFinalSnapshot {
opts.FinalDBSnapshotIdentifier = aws.String(name.(string))
if !skipFinalSnapshot {
if name, present := d.GetOk("final_snapshot_identifier"); present {
opts.FinalDBSnapshotIdentifier = aws.String(name.(string))
} else {
return fmt.Errorf("DB Instance FinalSnapshotIdentifier is required when a final snapshot is required")
}
}
log.Printf("[DEBUG] DB Instance destroy configuration: %v", opts)