Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add periodic trigger in trigger options #1632

Closed
wants to merge 2 commits into from

Conversation

alexmos-db
Copy link
Contributor

Changes

  • Add periodic triggers to trigger options to follow terraform definition

Tests

  • DAB deployment with CLI using periodic triggers

Long term we should look into retiring this manual allowlist, and look into autogenerating from SDK.

@@ -1396,11 +1396,17 @@ type ResourceJobTriggerTableUpdate struct {
WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"`
}

type ResourceJobTriggerPeriodic struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is auto-generated from Databricks Terraform provider schema and should not be edited manually. Instead please follow https://github.com/databricks/cli/tree/main/bundle/internal/tf/codegen

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reason why it might not auto-generate now is that your changes for period was not added in TF schema here
https://github.com/databricks/terraform-provider-databricks/blob/154ea38202a53d2c406904f6dcb6c31524956034/jobs/resource_job.go#L517

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like running the autogenic steps you mentioned includes the changes we need from our side.

The changes are quite large:

➜  cli git:(periodic) ✗ git diff --stat
 bundle/internal/tf/schema/config.go                         |  61 ++++++++++---------
 bundle/internal/tf/schema/data_source_cluster.go            | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 bundle/internal/tf/schema/data_source_external_location.go  |   1 +
 bundle/internal/tf/schema/data_source_job.go                |  52 +++++++++++-----
 bundle/internal/tf/schema/data_source_storage_credential.go |   1 +
 bundle/internal/tf/schema/data_sources.go                   | 198 +++++++++++++++++++++++++++++++-----------------------------
 bundle/internal/tf/schema/resource_external_location.go     |   1 +
 bundle/internal/tf/schema/resource_job.go                   |  62 +++++++++++--------
 bundle/internal/tf/schema/resource_metastore_data_access.go |   1 +
 bundle/internal/tf/schema/resource_mws_workspaces.go        |   1 +
 bundle/internal/tf/schema/resource_online_table.go          |   9 +--
 bundle/internal/tf/schema/resource_permissions.go           |   1 +
 bundle/internal/tf/schema/resource_storage_credential.go    |   2 +
 bundle/internal/tf/schema/resource_system_schema.go         |   1 +
 bundle/internal/tf/schema/resources.go                      |   4 ++
 15 files changed, 449 insertions(+), 178 deletions(-)

How shall we proceed here? What is the usual process for running this autogen? Shouldn't it happen automatically when we bump the terraform provider version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it does not happen automatically, we run the changes manually when upgrading TF provider to a new version.

CLI is already upgraded to the latest version of TF provider here #1626 and the changes were auto-generated, so not entirely sure where you diff comes through

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline. This is the solution: #1635

Closing this PR, thanks.

@alexmos-db alexmos-db closed this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants