diff --git a/catalog/resource_online_table.go b/catalog/resource_online_table.go index 0dd75ffe90..a31b9cf357 100644 --- a/catalog/resource_online_table.go +++ b/catalog/resource_online_table.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log" "time" "github.com/databricks/databricks-sdk-go" @@ -64,6 +65,16 @@ func ResourceOnlineTable() common.Resource { runTypes := []string{"spec.0.run_triggered", "spec.0.run_continuously"} common.CustomizeSchemaPath(m, "spec", "run_triggered").SetAtLeastOneOf(runTypes).SetSuppressDiff() common.CustomizeSchemaPath(m, "spec", "run_continuously").SetAtLeastOneOf(runTypes).SetSuppressDiff() + + m["no_wait"] = &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: false, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return true + }, + } + return m }) @@ -79,11 +90,15 @@ func ResourceOnlineTable() common.Resource { if err != nil { return err } - // this should be specified in the API Spec - filed a ticket to add it - err = waitForOnlineTableCreation(w, ctx, res.Name) - if err != nil { - - return err + noWait := d.Get("no_wait").(bool) + if noWait { + log.Print("[INFO] Not waiting for online table creation") + } else { + // this should be specified in the API Spec - filed a ticket to add it + err = waitForOnlineTableCreation(w, ctx, res.Name) + if err != nil { + return err + } } d.SetId(res.Name) return nil diff --git a/docs/resources/online_table.md b/docs/resources/online_table.md index 66aa48025c..2501e32926 100644 --- a/docs/resources/online_table.md +++ b/docs/resources/online_table.md @@ -50,6 +50,7 @@ In addition to all arguments above, the following attributes are exported: * `status` - object describing status of the online table: * `detailed_state` - The state of the online table. * `message` - A text description of the current state of the online table. +* `no_wait` - optional boolean flag specifying if we shouldn't wait until table update is done. **Note: there is a chance that table could be in failed state if something goes wrong, so use this flag carefully!** ## Import