Skip to content

Commit db61465

Browse files
authored
Document table_update trigger in databricks_job resource (#5107)
## Changes <!-- Summary of your changes that are easy to understand --> Also improved validation for trigger-related attributes ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] `make test` run locally - [x] relevant change in `docs/` folder - [ ] covered with integration tests in `internal/acceptance` - [ ] using Go SDK - [ ] using TF Plugin Framework - [x] has entry in `NEXT_CHANGELOG.md` file
1 parent 17000a5 commit db61465

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
### Documentation
1414

15+
* Document `table_update` trigger in `databricks_job` resource ([#5107](https://github.com/databricks/terraform-provider-databricks/pull/5107))
1516
* Document new attributes in `databricks_app` resource and data sources ([#5108](https://github.com/databricks/terraform-provider-databricks/pull/5108))
1617
* Document `git_email` in `databricks_git_credential` resource ([#5099](https://github.com/databricks/terraform-provider-databricks/pull/5099))
1718

docs/resources/job.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,17 @@ This block describes the queue settings of the job:
430430

431431
* `pause_status` - (Optional) Indicate whether this trigger is paused or not. Either `PAUSED` or `UNPAUSED`. When the `pause_status` field is omitted in the block, the server will default to using `UNPAUSED` as a value for `pause_status`.
432432
* `periodic` - (Optional) configuration block to define a trigger for Periodic Triggers consisting of the following attributes:
433-
* `interval` - (Required) Specifies the interval at which the job should run. This value is required.
434-
* `unit` - (Required) Options are {"DAYS", "HOURS", "WEEKS"}.
433+
* `interval` - (Required, integer) Specifies the interval at which the job should run.
434+
* `unit` - (Required, string) The unit of time for the interval. Possible values are: `DAYS`, `HOURS`, `WEEKS`.
435435
* `file_arrival` - (Optional) configuration block to define a trigger for [File Arrival events](https://learn.microsoft.com/en-us/azure/databricks/workflows/jobs/file-arrival-triggers) consisting of following attributes:
436436
* `url` - (Required) URL to be monitored for file arrivals. The path must point to the root or a subpath of the external location. Please note that the URL must have a trailing slash character (`/`).
437-
* `min_time_between_triggers_seconds` - (Optional) If set, the trigger starts a run only after the specified amount of time passed since the last time the trigger fired. The minimum allowed value is 60 seconds.
438-
* `wait_after_last_change_seconds` - (Optional) If set, the trigger starts a run only after no file activity has occurred for the specified amount of time. This makes it possible to wait for a batch of incoming files to arrive before triggering a run. The minimum allowed value is 60 seconds.
437+
* `min_time_between_triggers_seconds` - (Optional, integer) If set, the trigger starts a run only after the specified amount of time passed since the last time the trigger fired. The minimum allowed value is 60 seconds.
438+
* `wait_after_last_change_seconds` - (Optional, integer) If set, the trigger starts a run only after no file activity has occurred for the specified amount of time. This makes it possible to wait for a batch of incoming files to arrive before triggering a run. The minimum allowed value is 60 seconds.
439+
* `table_update` - (Optional) configuration block to define a trigger for [Table Updates](https://docs.databricks.com/aws/en/jobs/trigger-table-update) consisting of following attributes:
440+
* `table_names` - (Required) A non-empty list of tables to monitor for changes. The table name must be in the format `catalog_name.schema_name.table_name`.
441+
* `condition` - (Required, string) The table(s) condition based on which to trigger a job run. Possible values are `ANY_UPDATED`, `ALL_UPDATED`.
442+
* `min_time_between_triggers_seconds` - (Optional, integer) If set, the trigger starts a run only after the specified amount of time passed since the last time the trigger fired. The minimum allowed value is 60 seconds.
443+
* `wait_after_last_change_seconds` - (Optional, integer) If set, the trigger starts a run only after no file activity has occurred for the specified amount of time. This makes it possible to wait for a batch of incoming files to arrive before triggering a run. The minimum allowed value is 60 seconds.
439444

440445
### git_source Configuration Block
441446

jobs/resource_job.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,12 @@ func (JobSettingsResource) CustomizeSchema(s *common.CustomizableSchema) *common
594594
s.SchemaPath("trigger", "table_update").SetExactlyOneOf(trigger_eoo)
595595
s.SchemaPath("trigger", "periodic").SetExactlyOneOf(trigger_eoo)
596596

597+
s.SchemaPath("trigger", "periodic", "interval").SetValidateDiagFunc(validation.ToDiagFunc(validation.IntAtLeast(1))) // .SetRequired()
598+
s.SchemaPath("trigger", "periodic", "unit").SetValidateFunc(validation.StringInSlice([]string{"DAYS", "HOURS", "WEEKS"}, false)) //.SetRequired()
599+
s.SchemaPath("trigger", "file_arrival", "url").SetValidateFunc(validation.StringIsNotEmpty) // .SetRequired()
600+
s.SchemaPath("trigger", "table_update", "table_names").SetMinItems(1) //.SetRequired()
601+
s.SchemaPath("trigger", "table_update", "condition").SetValidateFunc(validation.StringInSlice([]string{"ANY_UPDATED", "ALL_UPDATED"}, false)) // .SetRequired()
602+
597603
// Deprecated Job API 2.0 attributes
598604
var topLevelDeprecatedAttr = []string{
599605
"max_retries",

0 commit comments

Comments
 (0)