Skip to content

Commit

Permalink
Fix addition of DeletionProtectionEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhamAvasthi committed Aug 25, 2022
1 parent e8e227b commit a62d399
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -867,13 +867,16 @@ func resourceSqlDatabaseInstanceCreate(d *schema.ResourceData, meta interface{})
cloneContext, cloneSource := expandCloneContext(d.Get("clone").([]interface{}))

s, ok := d.GetOk("settings")
desiredSettings := expandSqlDatabaseInstanceSettings(s.([]interface{}))
desiredSettings := d.Get("deletion_protection").(bool)
desiredSettings.DeletionProtectionEnabled = desiredSettings
if ok {
instance.Settings = desiredSettings
} else {
instance.Settings = &sqladmin.Settings{
DeletionProtectionEnabled: d.Get("deletion_protection").(bool),
}
}

instance.Settings.DeletionProtectionEnabled = d.Get("deletion_protection").(bool)

instance.RootPassword = d.Get("root_password").(string)

// Modifying a replica during Create can cause problems if the master is
Expand Down

0 comments on commit a62d399

Please sign in to comment.