管理数据砖使用起程拓殖工作区
以下配置模块初始化最常见的变量,databricks_spark_version,databricks_node_type,databricks_current_user。
起程拓殖{required_providers{砖={源=“砖/砖"}}}提供者“砖”{}数据“databricks_current_user”“我”{}“databricks_spark_version”“最新”{}数据“databricks_node_type”“最小”{local_disk = true}
标准功能
这些资源不需要管理权限。更多的文档可以在专用的页面databricks_secret_scope,databricks_token,databricks_secret,databricks_notebook,databricks_job,databricks_cluster,databricks_cluster_policy,databricks_instance_pool。
资源“databricks_secret_scope””这个“{name = " $ {data.databricks_current_user.me演示。字母数字}}资源“databricks_token”“拍”{评论=“创建从$ {abspath (path.module)}“lifetime_seconds = 3600}资源”databricks_secret”“令牌”{string_value = databricks_token.pat。token_value范围= databricks_secret_scope.this.name关键资源“databricks_notebook”=“令牌”}”这种“= " $ {data.databricks_current_user.me{路径。回家}/起程拓殖PYTHON“语言= content_base64 = base64encode(< <测试结束令牌= dbutils.secrets.get (“$ {databricks_secret_scope.this.name}”,“$ {databricks_secret.token.key}”)打印(f 'This应该修订:{牌}”)测试结束)}资源“databricks_job”“这“{name = "起程拓殖演示($ {data.databricks_current_user.me.alphanumeric})“new_cluster {num_workers = 1 spark_version = data.databricks_spark_version.latest。id node_type_id = data.databricks_node_type.smallest。id} notebook_task {notebook_path = databricks_notebook.this。路径}email_notifications资源“databricks_cluster”“这“{}}{cluster_name =“勘探($ {data.databricks_current_user.me.alphanumeric})”spark_version = data.databricks_spark_version.latest。id instance_pool_id = databricks_instance_pool.smallest_nodes。id autotermination_minutes = 20自动定量{min_workers = 1 max_workers = 10}}资源“databricks_cluster_policy”“这“{name = "最小($ {data.databricks_current_user.me.alphanumeric})”定义= jsonencode ({“dbus_per_hour”:{“类型”:“范围”、“执行”:10},“autotermination_minutes”:{“类型”:“固定”,“价值”:20,“隐藏”:真正}})}资源“databricks_instance_pool”“smallest_nodes”{instance_pool_name =“最小的节点($ {data.databricks_current_user.me.alphanumeric})”min_idle_instances = 0 max_capacity = 30 node_type_id = data.databricks_node_type.smallest。(data.databricks_spark_version.latest id preloaded_spark_versions =。id] idle_instance_autotermination_minutes = 20} {value = databricks_notebook.this“notebook_url”输出。url} {value = databricks_job.this“job_url”输出。url}
工作区安全
安全管理需要管理权限。更多的文档可以在专用的页面databricks_secret_acl,databricks_group,databricks_user,databricks_group_member,databricks_permissions。
资源”databricks_secret_acl”“观众”{= databricks_group.spectators校长。display_name范围= databricks_secret_scope.this.name许可=“读”}资源“databricks_group”“观众”{display_name =“观众($ {data.databricks_current_user.me.alphanumeric}) "} resource "databricks_user" "dummy" { user_name = "dummy+${data.databricks_current_user.me.alphanumeric}@example.com" display_name = "Dummy ${data.databricks_current_user.me.alphanumeric}" } resource "databricks_group_member" "a" { group_id = databricks_group.spectators.id member_id = databricks_user.dummy.id } resource "databricks_permissions" "notebook" { notebook_path = databricks_notebook.this.id access_control { user_name = databricks_user.dummy.user_name permission_level = "CAN_RUN" } access_control { group_name = databricks_group.spectators.display_name permission_level = "CAN_READ" } } resource "databricks_permissions" "job" { job_id = databricks_job.this.id access_control { user_name = databricks_user.dummy.user_name permission_level = "IS_OWNER" } access_control { group_name = databricks_group.spectators.display_name permission_level = "CAN_MANAGE_RUN" } } resource "databricks_permissions" "cluster" { cluster_id = databricks_cluster.this.id access_control { user_name = databricks_user.dummy.user_name permission_level = "CAN_RESTART" } access_control { group_name = databricks_group.spectators.display_name permission_level = "CAN_ATTACH_TO" } } resource "databricks_permissions" "policy" { cluster_policy_id = databricks_cluster_policy.this.id access_control { group_name = databricks_group.spectators.display_name permission_level = "CAN_USE" } } resource "databricks_permissions" "pool" { instance_pool_id = databricks_instance_pool.smallest_nodes.id access_control { group_name = databricks_group.spectators.display_name permission_level = "CAN_ATTACH_TO" } }
存储
根据您的喜好和需求,你可以
管理JAR、车轮和卵子库通过databricks_dbfs_file资源。
在DBFS列表条目databricks_dbfs_file_paths数据源。
小文件的内容databricks_dbfs_file数据源。
AWS存储使用databricks_aws_s3_mount资源。
高级配置
更多的文档可以在专门的页面databricks_workspace_conf和databricks_ip_access_list资源。
数据“http”“我”{url = " https://ifconfig。我“}资源“databricks_workspace_conf”“这”{custom_config = {“enableIpAccessLists”:“true”}}资源”databricks_ip_access_list only_me”{label = " $ {data.http.my。身体}是允许访问工作区”list_type = "允许" ip_addresses = [" $ {data.http.my。身体}/ 32 "][databricks_workspace_conf depends_on =。这]}