Skip to content

Commit

Permalink
Spanner Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
rambleraptor authored and modular-magician committed Jul 8, 2019
1 parent d80918c commit 0e4df92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
14 changes: 14 additions & 0 deletions google/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
26 changes: 0 additions & 26 deletions google/resource_spanner_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,6 @@ func resourceSpannerInstanceUpdate(d *schema.ResourceData, meta interface{}) err
return fmt.Errorf("Error updating Instance %q: %s", d.Id(), err)
}

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

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

if err != nil {
return err
}

return resourceSpannerInstanceRead(d, meta)
}

Expand All @@ -292,19 +279,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 0e4df92

Please sign in to comment.