Skip to content

Support for data sources #3460

@malthe

Description

@malthe

In Terraform, you can declare a data source which is essentially a resource that is externally managed, but must exist.

The Databricks Terraform provider already supports this for a number of resources including schemas, e.g.

data "databricks_schemas" "sandbox" {
  catalog_name = "sandbox"
}

DABs should use this to support defining resources such as schemas that are required to exist in the catalog, but which aren't managed by the bundle.

The motivation is that sometimes we want to reference resources without having the bundle own them (for example schemas).

Syntax

We could introduce a property bind which would default to true.

This is how it would look for a schema resource:

resources:
  schemas:
    bronze:
      bind: false
      name: bronze
      catalog_name: dev

Setting bind: false would mean that the resource should already exist and we'll compare the resource data to the definition.

An alternative would be to introduce a concept of sources which would be in addition to resources. This would allow these sources to be specified by name without a complete definition, similar to Terraform's data sources:

sources:
  schemas:
    bronze:
      name: bronze
      catalog_name: dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions