Skip to content

Commit

Permalink
Spanner Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
rambleraptor authored and modular-magician committed Jul 12, 2019
1 parent df3582c commit 4d1ed0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
14 changes: 14 additions & 0 deletions google-beta/resource_spanner_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ func resourceSpannerDatabaseCreate(d *schema.ResourceData, meta interface{}) err
}
d.SetId(id)

project, err := getProject(d, config)
if err != nil {
return err
}
waitErr := spannerOperationWaitTime(
config, res, project, "Creating Database",
int(d.Timeout(schema.TimeoutCreate).Minutes()))

if waitErr != nil {
// The resource didn't actually create
d.SetId("")
return fmt.Errorf("Error waiting to create Database: %s", waitErr)
}

log.Printf("[DEBUG] Finished creating Database %q: %#v", d.Id(), res)

return resourceSpannerDatabaseRead(d, meta)
Expand Down
13 changes: 0 additions & 13 deletions google-beta/resource_spanner_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,6 @@ func resourceSpannerInstanceDelete(d *schema.ResourceData, meta interface{}) err
return handleNotFoundError(err, d, "Instance")
}

project, err := getProject(d, config)
if err != nil {
return err
}

err = spannerOperationWaitTime(
config, res, project, "Deleting Instance",
int(d.Timeout(schema.TimeoutDelete).Minutes()))

if err != nil {
return err
}

log.Printf("[DEBUG] Finished deleting Instance %q: %#v", d.Id(), res)
return nil
}
Expand Down

0 comments on commit 4d1ed0e

Please sign in to comment.