From 6082e3e732cb4a1f7405e27757a4217ed61b9446 Mon Sep 17 00:00:00 2001 From: stack72 Date: Wed, 11 Nov 2015 16:39:24 +0000 Subject: [PATCH] Changing the db_instance to throw an error is a final snapshot is required but yet no identified is given --- builtin/providers/aws/resource_aws_db_instance.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index ac6205cd2..4699112bc 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -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)