Skip to content

Commit

Permalink
Ensure split id length and report error otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
gh-mlfowler committed Jun 21, 2017
1 parent 88d5232 commit 2605a17
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions google/resource_sql_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ func resourceSqlDatabaseRead(d *schema.ResourceData, meta interface{}) error {
}

s := strings.Split(d.Id(), ":")

if len(s) != 2 {
return fmt.Errorf("Error, failure importing database %s. "+
"ID format is instance:name", d.Id())
}

instance_name := s[0]
database_name := s[1]

Expand Down

0 comments on commit 2605a17

Please sign in to comment.