confluent_schemas
describes a Schema data source.
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_schemas" "main" {
schema_registry_cluster {
id = confluent_schema_registry_cluster.essentials.id
}
rest_endpoint = confluent_schema_registry_cluster.essentials.rest_endpoint
filter {
subject_prefix = "examples.record"
latest_only = false
deleted = true
}
credentials {
key = "<Schema Registry API Key for confluent_schema_registry_cluster.essentials>"
secret = "<Schema Registry API Secret for confluent_schema_registry_cluster.essentials>"
}
}
output "schemas" {
value = data.confluent_schemas.main.schemas
}
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_schemas" "main" {
filter {
subject_prefix = "examples.record"
latest_only = false
deleted = true
}
}
output "schemas" {
value = data.confluent_schemas.main.schemas
}
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.filter
(Optional Configuration Block) supports the following:
subject_prefix
- (Optional String) The prefix of the subjects (in other words, the namespaces), representing the subjects under which the schemas are registered.deleted
- (Optional Boolean) The boolean flag to control whether to return soft deleted schemas. Defaults to false
.latest_only
- (Optional Boolean) The boolean flag to control whether to return latest schema versions only for each matching subject. Defaults to false
.In addition to the preceding arguments, the following attributes are exported:
schemas
(List of Object) List of schemas. Each schema object exports the following attributes:
subject_name
- (Required String) The name of the subject.schema_identifier
- (Required String) The ID of the Schema, for example: lsrc-abc123/test-subject/100003
.format
- (Required String) The format of the schema. Accepted values are: AVRO
, PROTOBUF
, and JSON
.schema
- (Required String) The schema string.schema_reference
- (Optional List) The list of referenced schemas (see Schema References for more details):name
- (Required String) The name of the subject, representing the subject under which the referenced schema is registered.subject_name
- (Required String) The name for the reference. (For Avro Schema, the reference name is the fully qualified schema name, for JSON Schema it is a URL, and for Protobuf Schema, it is the name of another Protobuf file.)version
- (Required Integer) The version, representing the exact version of the schema under the registered subject.version
- (Required Integer) The version of the Schema, for example, 4
.