confluent_kafka_mirror_topic
provides a Kafka Mirror Topic resource that enables creating and deleting Kafka Mirror Topics on a Kafka cluster on Confluent Cloud.
resource "confluent_kafka_mirror_topic" "example" {
source_kafka_topic {
topic_name = "orders"
}
cluster_link {
link_name = confluent_cluster_link.source-outbound.link_name
}
kafka_cluster {
id = data.confluent_kafka_cluster.destination.id
rest_endpoint = data.confluent_kafka_cluster.destination.rest_endpoint
credentials {
key = confluent_api_key.app-manager-destination-cluster-api-key.id
secret = confluent_api_key.app-manager-destination-cluster-api-key.secret
}
}
lifecycle {
prevent_destroy = true
}
}
The following arguments are supported:
kafka_cluster
- (Required Configuration Block) supports the following:
id
- (Required String) The ID of the destination Kafka cluster, for example, lkc-abc123
.rest_endpoint
- (Required String) The REST endpoint of the destination Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443
).credentials
(Required Configuration Block) supports the following:
key
- (Required String) The Kafka API Key.secret
- (Required String, Sensitive) The Kafka API Secret.cluster_link
- (Required Configuration Block) supports the following:
link_name
- (Required String) The name of the cluster link to attach to the mirror topic, for example, my-cluster-link
.source_kafka_topic
- (Required Configuration Block) supports the following:
topic_name
- (Required String) The name of the topic on the source cluster to be mirrored over the cluster link, for example, orders
. A topic with the exact same name must exist on the source cluster, and no topic with this name should exist on the destination cluster.mirror_topic_name
- (Optional String) The name of the mirror topic. Only required when there is a prefix configured on the cluster link. For example, when <prefix>
is configured for the cluster link, the mirror topic name has to be of the format <prefix><source_topic_name>
.status
(Optional String) The status of the mirror topic. The supported values are "ACTIVE"
, "PAUSED"
, "PROMOTED"
, "FAILED_OVER"
. Pausing ("ACTIVE" -> "PAUSED"
), resuming ("PAUSED" -> "ACTIVE"
), promoting, and failing over a mirror topic is supported via an update operation. Defaults to "ACTIVE"
.In addition to the preceding arguments, the following attributes are exported:
id
- (Required String) The ID of the Kafka mirror topic, in the format <Kafka cluster ID>/<Cluster link name>/<Kafka Mirror Topic name>
, for example, lkc-abc123/my-cluster-link/orders-123
.You can import a Kafka mirror topic by using the Kafka cluster ID, cluster link name, and Kafka topic name in the format <Kafka cluster ID>/<Cluster link name>/<Kafka topic name>
, for example:
$ export IMPORT_KAFKA_API_KEY="<kafka_api_key>"
$ export IMPORT_KAFKA_API_SECRET="<kafka_api_secret>"
$ export IMPORT_KAFKA_REST_ENDPOINT="<kafka_rest_endpoint>"
$ terraform import confluent_kafka_mirror_topic.my_mirror_topic lkc-abc123/my-cluster-link/orders-123
The following end-to-end examples might help to get started with confluent_kafka_mirror_topic
resource:
destination-initiated-cluster-link-rbac
: An example of setting up a _destination_ initiated cluster link with a mirror topicsource-initiated-cluster-link-rbac
: An example of setting up a _source_ initiated cluster link with a mirror topicSee Mirror Topics on Confluent Cloud to learn more about Mirror Topics on Confluent Cloud.