diff --git a/exporter/importables.go b/exporter/importables.go index 058cb8629..326490f56 100644 --- a/exporter/importables.go +++ b/exporter/importables.go @@ -443,16 +443,23 @@ var resourcesMap map[string]importable = map[string]importable{ {Path: "task.sql_task.dashboard.dashboard_id", Resource: "databricks_sql_dashboard"}, {Path: "task.sql_task.query.query_id", Resource: "databricks_query"}, {Path: "task.sql_task.warehouse_id", Resource: "databricks_sql_endpoint"}, - {Path: "task.webhook_notifications.on_duration_warning_threshold_exceeded.id", Resource: "databricks_notification_destination"}, + {Path: "task.webhook_notifications.on_duration_warning_threshold_exceeded.id", + Resource: "databricks_notification_destination"}, {Path: "task.webhook_notifications.on_failure.id", Resource: "databricks_notification_destination"}, {Path: "task.webhook_notifications.on_start.id", Resource: "databricks_notification_destination"}, {Path: "task.webhook_notifications.on_success.id", Resource: "databricks_notification_destination"}, {Path: "task.webhook_notifications.on_streaming_backlog_exceeded.id", Resource: "databricks_notification_destination"}, + {Path: "parameter.default", Resource: "databricks_workspace_file", Match: "workspace_path"}, + {Path: "parameter.default", Resource: "databricks_workspace_file", Match: "path"}, + {Path: "parameter.default", Resource: "databricks_file", Match: "path"}, {Path: "task.email_notifications.on_duration_warning_threshold_exceeded", Resource: "databricks_user", Match: "user_name", MatchType: MatchCaseInsensitive}, - {Path: "task.email_notifications.on_failure", Resource: "databricks_user", Match: "user_name", MatchType: MatchCaseInsensitive}, - {Path: "task.email_notifications.on_start", Resource: "databricks_user", Match: "user_name", MatchType: MatchCaseInsensitive}, - {Path: "task.email_notifications.on_success", Resource: "databricks_user", Match: "user_name", MatchType: MatchCaseInsensitive}, + {Path: "task.email_notifications.on_failure", Resource: "databricks_user", Match: "user_name", + MatchType: MatchCaseInsensitive}, + {Path: "task.email_notifications.on_start", Resource: "databricks_user", Match: "user_name", + MatchType: MatchCaseInsensitive}, + {Path: "task.email_notifications.on_success", Resource: "databricks_user", Match: "user_name", + MatchType: MatchCaseInsensitive}, {Path: "task.email_notifications.on_streaming_backlog_exceeded", Resource: "databricks_user", Match: "user_name", MatchType: MatchCaseInsensitive}, {Path: "run_as.user_name", Resource: "databricks_user", Match: "user_name", MatchType: MatchCaseInsensitive}, @@ -496,7 +503,8 @@ var resourcesMap map[string]importable = map[string]importable{ MatchType: MatchPrefix, SearchValueTransformFunc: appendEndingSlashToDirName}, {Path: "job_cluster.new_cluster.init_scripts.workspace.destination", Resource: "databricks_repo", Match: "workspace_path", MatchType: MatchPrefix, SearchValueTransformFunc: appendEndingSlashToDirName}, - {Path: "job_cluster.new_cluster.init_scripts.workspace.destination", Resource: "databricks_repo", Match: "path", + {Path: "job_cluster.new_cluster.init_scripts.workspace.destination", Resource: "databricks_repo", Match: "path"}, + {Path: "parameter.default", Resource: "databricks_repo", Match: "workspace_path", MatchType: MatchPrefix, SearchValueTransformFunc: appendEndingSlashToDirName}, }, Import: func(ic *importContext, r *resource) error { @@ -668,6 +676,10 @@ var resourcesMap map[string]importable = map[string]importable{ ic.emitJobsDestinationNotifications(job.WebhookNotifications.OnStart) ic.emitJobsDestinationNotifications(job.WebhookNotifications.OnStreamingBacklogExceeded) } + for _, param := range job.Parameters { + ic.emitIfWsfsFile(param.Default) + ic.emitIfVolumeFile(param.Default) + } return ic.importLibraries(r.Data, s) }, diff --git a/exporter/util_workspace.go b/exporter/util_workspace.go index f8c0c371f..09300ee88 100644 --- a/exporter/util_workspace.go +++ b/exporter/util_workspace.go @@ -52,8 +52,8 @@ func hasWorkspacePrefix(path string) bool { } func maybeStripWorkspacePrefix(path string) string { - if hasWorkspacePrefix(path) { - return path[10:] + if strings.HasPrefix(path, "/Workspace/") { + return strings.TrimPrefix(path, "/Workspace") } return path }