confluent_business_metadata_binding Resource

General Availability

confluent_business_metadata_binding provides a Business Metadata Binding resource that enables creating, editing, and deleting Business Metadata Bindings on Confluent Cloud.

Example Usage

Option #1: Manage multiple Schema Registry clusters in the same Terraform workspace

provider "confluent" {
  cloud_api_key    = var.confluent_cloud_api_key    # optionally use CONFLUENT_CLOUD_API_KEY env var
  cloud_api_secret = var.confluent_cloud_api_secret # optionally use CONFLUENT_CLOUD_API_SECRET env var
}

data "confluent_kafka_topic" "main" {
  topic_name = "orders"
}

resource "confluent_business_metadata_binding" "main" {
  schema_registry_cluster {
    id = confluent_schema_registry_cluster.essentials.id
  }
  rest_endpoint = confluent_schema_registry_cluster.essentials.rest_endpoint
  credentials {
    key    = "<Schema Registry API Key for confluent_schema_registry_cluster.essentials>"
    secret = "<Schema Registry API Secret for confluent_schema_registry_cluster.essentials>"
  }

  business_metadata_name = confluent_business_metadata.pii.name
  entity_name = "${var.schema_registry_id}:${var.kafka_id}:${data.confluent_kafka_topic.main.topic_name}"
  entity_type = "kafka_topic"
  attributes = {
    "team" = "teamName"
    "email" = "team@company.com"
  }

  lifecycle {
    prevent_destroy = true
  }
}

Option #2: Manage a single Schema Registry cluster in the same Terraform workspace

provider "confluent" {
  schema_registry_id            = var.schema_registry_id            # optionally use SCHEMA_REGISTRY_ID env var
  schema_registry_rest_endpoint = var.schema_registry_rest_endpoint # optionally use SCHEMA_REGISTRY_REST_ENDPOINT env var
  schema_registry_api_key       = var.schema_registry_api_key       # optionally use SCHEMA_REGISTRY_API_KEY env var
  schema_registry_api_secret    = var.schema_registry_api_secret    # optionally use SCHEMA_REGISTRY_API_SECRET env var
}

data "confluent_kafka_topic" "main" {
  topic_name = "orders"
}

resource "confluent_business_metadata_binding" "main" {
  business_metadata_name = confluent_business_metadata.pii.name
  entity_name = "${var.schema_registry_id}:${var.kafka_id}:${data.confluent_kafka_topic.main.topic_name}"
  entity_type = "kafka_topic"
  attributes = {
    "team" = "teamName"
    "email" = "team@company.com"
  }

  lifecycle {
    prevent_destroy = true
  }
}

Argument Reference

The following arguments are supported:

Attributes Reference

In addition to the preceding arguments, the following attributes are exported:

Import

You can import a Business Metadata Binding by using the Schema Registry cluster ID, Business Metadata name, entity name and entity type in the format <Schema Registry Cluster Id>/<Business Metadata Name>/<Entity Name>/<Entity Type>, for example:

$ export IMPORT_SCHEMA_REGISTRY_API_KEY="<schema_registry_api_key>"
$ export IMPORT_SCHEMA_REGISTRY_API_SECRET="<schema_registry_api_secret>"
$ export IMPORT_SCHEMA_REGISTRY_REST_ENDPOINT="<schema_registry_rest_endpoint>"
$ terraform import confluent_business_metadata_binding.main lsrc-8wrx70/PII/lsrc-8wrx70:.:100001/sr_schema

Getting Started

The following end-to-end example might help to get started with Stream Catalog: