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 20, 2017
1 parent 6274602 commit 4e10b77
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:database_name", d.Id())
}

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

Expand Down

0 comments on commit 4e10b77

Please sign in to comment.