Clear BigtableTable schema when resource missing, pass along missing error.

This commit is contained in:
Riley Karson 2017-06-28 12:49:12 -07:00 committed by Riley Karson
parent d0d116fa3e
commit a358f4147f

View File

@ -6,6 +6,7 @@ import (
"github.com/hashicorp/terraform/helper/schema"
"golang.org/x/net/context"
"log"
)
func resourceBigtableTable() *schema.Resource {
@ -99,7 +100,9 @@ func resourceBigtableTableRead(d *schema.ResourceData, meta interface{}) error {
name := d.Id()
_, err = c.TableInfo(ctx, name)
if err != nil {
return fmt.Errorf("Error retrieving table. Could not find %s in %s.", name, instanceName)
log.Printf("[WARN] Removing %s because it's gone", name)
d.SetId("")
return fmt.Errorf("Error retrieving table. Could not find %s in %s. %s", name, instanceName, err)
}
return nil