|
| 1 | +--- |
| 2 | +subcategory: "Apps" |
| 3 | +--- |
| 4 | +# databricks_app Resource |
| 5 | + |
| 6 | +-> This feature is in [Public Preview](https://docs.databricks.com/release-notes/release-types.html). |
| 7 | + |
| 8 | +[Databricks Apps](https://docs.databricks.com/en/dev-tools/databricks-apps/index.html) run directly on a customer’s Databricks instance, integrate with their data, use and extend Databricks services, and enable users to interact through single sign-on. This resource creates the application but does not handle app deployment, which should be handled separately as part of your CI/CD pipeline. |
| 9 | + |
| 10 | +## Example Usage |
| 11 | + |
| 12 | +```hcl |
| 13 | +resource "databricks_app" "this" { |
| 14 | + name = "my-custom-app" |
| 15 | + description = "My app" |
| 16 | + resources = [{ |
| 17 | + name = "sql-warehouse" |
| 18 | + sql_warehouse = { |
| 19 | + id = "e9ca293f79a74b5c" |
| 20 | + permission = "CAN_MANAGE" |
| 21 | + } |
| 22 | + }, |
| 23 | + { |
| 24 | + name = "serving-endpoint" |
| 25 | + serving_endpoint = { |
| 26 | + name = "databricks-meta-llama-3-1-70b-instruct" |
| 27 | + permission = "CAN_MANAGE" |
| 28 | + } |
| 29 | + }, |
| 30 | + { |
| 31 | + name = "job" |
| 32 | + job = { |
| 33 | + id = "1234" |
| 34 | + permission = "CAN_MANAGE" |
| 35 | + } |
| 36 | + }] |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +## Argument Reference |
| 41 | + |
| 42 | +The following arguments are required: |
| 43 | + |
| 44 | +* `name` - (Required) The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It must be unique within the workspace. |
| 45 | +* `description` - (Optional) The description of the app. |
| 46 | +* `resources` - (Optional) A list of resources that the app have access to. |
| 47 | + |
| 48 | +### resources Configuration Attribute |
| 49 | + |
| 50 | +This attribute describes a resource used by the app. |
| 51 | + |
| 52 | +* `name` - (Required) The name of the resource. |
| 53 | +* `description` - (Optional) The description of the resource. |
| 54 | + |
| 55 | +Exactly one of the following attributes must be provided: |
| 56 | + |
| 57 | +* `secret` attribute |
| 58 | + * `scope` - Scope of the secret to grant permission on. |
| 59 | + * `key` - Key of the secret to grant permission on. |
| 60 | + * `permission` - Permission to grant on the secret scope. For secrets, only one permission is allowed. Permission must be one of: `READ`, `WRITE`, `MANAGE`. |
| 61 | +* `sql_warehouse` attribute |
| 62 | + * `id` - Id of the SQL warehouse to grant permission on. |
| 63 | + * `permission` - Permission to grant on the SQL warehouse. Supported permissions are: `CAN_MANAGE`, `CAN_USE`, `IS_OWNER`. |
| 64 | +* `serving_endpoint` attribute |
| 65 | + * `name` - Name of the serving endpoint to grant permission on. |
| 66 | + * `permission` - Permission to grant on the serving endpoint. Supported permissions are: `CAN_MANAGE`, `CAN_QUERY`, `CAN_VIEW`. |
| 67 | +* `job` attribute |
| 68 | + * `id` - Id of the job to grant permission on. |
| 69 | + * `permission` - Permissions to grant on the Job. Supported permissions are: `CAN_MANAGE`, `IS_OWNER`, `CAN_MANAGE_RUN`, `CAN_VIEW`. |
| 70 | + |
| 71 | +## Attribute Reference |
| 72 | + |
| 73 | +In addition to all arguments above, the following attributes are exported: |
| 74 | + |
| 75 | +* `compute_status` attribute |
| 76 | + * `state` - State of the app compute. |
| 77 | + * `message` - Compute status message |
| 78 | +* `app_status` attribute |
| 79 | + * `state` - State of the application. |
| 80 | + * `message` - Application status message |
| 81 | +* `url` - The URL of the app once it is deployed. |
| 82 | +* `create_time` - The creation time of the app. |
| 83 | +* `creator` - The email of the user that created the app. |
| 84 | +* `update_time` - The update time of the app. |
| 85 | +* `updater` - The email of the user that last updated the app. |
| 86 | +* `service_principal_id` - id of the app service principal |
| 87 | +* `service_principal_name` - name of the app service principal |
| 88 | +* `default_source_code_path` - The default workspace file system path of the source code from which app deployment are created. This field tracks the workspace source code path of the last active deployment. |
| 89 | + |
| 90 | +## Import |
| 91 | + |
| 92 | +This resource can be imported by name: |
| 93 | + |
| 94 | +```hcl |
| 95 | +import { |
| 96 | + to = databricks_app.this |
| 97 | + id = "<app_name>" |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +or using the `terraform` CLI: |
| 102 | + |
| 103 | +```bash |
| 104 | +terraform import databricks_app.this <app_name> |
| 105 | +``` |
| 106 | + |
| 107 | +## Related Resources |
| 108 | + |
| 109 | +The following resources are used in the same context: |
| 110 | + |
| 111 | +* [databricks_sql_endpoint](sql_endpoint.md) to manage Databricks SQL [Endpoints](https://docs.databricks.com/sql/admin/sql-endpoints.html). |
| 112 | +* [databricks_model_serving](model_serving.md) to serve this model on a Databricks serving endpoint. |
| 113 | +* [databricks_secret](secret.md) to manage [secrets](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) in Databricks workspace. |
| 114 | +* [databricks_job](job.md) to manage [Databricks Jobs](https://docs.databricks.com/jobs.html) to run non-interactive code. |
0 commit comments