confluent_tag_binding
provides a Tag Binding resource that enables creating, editing, and deleting Tag Bindings on Confluent Cloud.
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_tag_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>"
}
tag_name = "PII"
entity_name = "${var.schema_registry_id}:${var.kafka_id}:${data.confluent_kafka_topic.main.topic_name}"
entity_type = "kafka_topic"
lifecycle {
prevent_destroy = true
}
}
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_tag_binding" "topic-tagging" {
tag_name = "PII"
entity_name = "${var.schema_registry_id}:${var.kafka_id}:${data.confluent_kafka_topic.main.topic_name}"
entity_type = "kafka_topic"
lifecycle {
prevent_destroy = true
}
}
The following arguments are supported:
schema_registry_cluster
- (Optional Configuration Block) supports the following:
id
- (Required String) The ID of the Schema Registry cluster, for example, lsrc-abc123
.rest_endpoint
- (Optional String) The REST endpoint of the Schema Registry cluster, for example, https://psrc-00000.us-central1.gcp.confluent.cloud:443
).credentials
(Optional Configuration Block) supports the following:
key
- (Required String) The Schema Registry API Key.secret
- (Required String, Sensitive) The Schema Registry API Secret.tag_name
- (Required String) The name of the tag to be applied, for example, PII
. The name must not be empty and consist of a letter followed by a sequence of letter, number, space, or _ characters.entity_name
- (Required String) The qualified name of the entity., for example, ${confluent_schema_registry_cluster.main.id}:.:${confluent_schema.purchase.schema_identifier}
, ${confluent_schema_registry_cluster.main.id}:${confluent_kafka_cluster.basic.id}:${confluent_kafka_topic.purchase.topic_name}
.entity_type
- (Required String) The entity type, for example, sr_schema
. Refer to the Entity types to learn more about entity types.In addition to the preceding arguments, the following attributes are exported:
id
- (Required String) The ID of the Tag Binding, in the format <Schema Registry Cluster Id>/<Tag Name>/<Entity Name>/<Entity Type>
, for example, lsrc-8wrx70/PII/lsrc-8wrx70:.:100001/sr_schema
.You can import a Tag Binding by using the Schema Registry cluster ID, Tag name, entity name and entity type in the format <Schema Registry Cluster Id>/<Tag 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_tag_binding.main lsrc-8wrx70/PII/lsrc-8wrx70:.:100001/sr_schema
The following end-to-end example might help to get started with Stream Catalog: