Skip to content

Commit

Permalink
Add ImportDatabase
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel authored and petoju committed Mar 13, 2021
1 parent 3e5fc63 commit d8960c2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mysql/resource_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func resourceDatabase() *schema.Resource {
Read: ReadDatabase,
Delete: DeleteDatabase,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
State: ImportDatabase,
},
Schema: map[string]*schema.Schema{
"name": {
Expand Down Expand Up @@ -194,3 +194,13 @@ func extractIdentAfter(sql string, keyword string) string {

return ""
}

func ImportDatabase(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
err := ReadDatabase(d, meta)

if err != nil {
return nil, err
}

return []*schema.ResourceData{d}, nil
}

0 comments on commit d8960c2

Please sign in to comment.