# This is a Databricks asset bundle definition for {{.project_name}}.
# See https://docs.databricks.com/dev-tools/bundles/index.html for documentation.
bundle:
  name: {{.project_name}}

include:
  - resources/*.yml

targets:
  # The 'dev' target, for development purposes. This target is the default.
  dev:
    # We use 'mode: development' to indicate this is a personal development copy:
    # - Deployed resources get prefixed with '[dev my_user_name]'
    # - Any job schedules and triggers are paused by default
    # - The 'development' mode is used for Delta Live Tables pipelines
    mode: development
    default: true
    workspace:
      host: {{workspace_host}}

  ## Optionally, there could be a 'staging' target here.
  ## (See Databricks docs on CI/CD at https://docs.databricks.com/dev-tools/bundles/index.html.)
  #
  # staging:
  #   workspace:
  #     host: {{workspace_host}}

  # The 'prod' target, used for production deployment.
  prod:
    # We use 'mode: production' to indicate this is a production deployment.
    # Doing so enables strict verification of the settings below.
    mode: production
    workspace:
      host: {{workspace_host}}
      # We always use /Users/{{user_name}} for all resources to make sure we only have a single copy.
      {{- /*
      Internal note 2023-12: CLI versions v0.211.0 and before would show an error when using `mode: production`
      with a path that doesn't say "/Shared". For now, we'll include an extra comment in the template
      to explain that customers should update if they see this.
      */}}
      # If this path results in an error, please make sure you have a recent version of the CLI installed.
      root_path: /Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target}
    run_as:
      {{- if is_service_principal}}
      service_principal_name: {{user_name}}
      {{- else}}
      # This runs as {{user_name}} in production. We could also use a service principal here,
      # see https://docs.databricks.com/dev-tools/bundles/permissions.html.
      user_name: {{user_name}}
      {{- end}}
