You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* **Simplicity**: Manage all your Redpanda Cloud resources in one place.
18
22
* **Automation**: Create and modify resources without manual intervention.
19
-
* **Version Control**: Track and roll back changes using version control systems such as GitHub.
23
+
* **Version Control**: Track and roll back changes using version control systems, such as GitHub.
20
24
* **Scalability**: Scale your infrastructure as your needs grow with minimal effort.
21
25
22
26
== Understand Terraform configurations
23
27
24
-
Terraform configurations are written in link:https://developer.hashicorp.com/terraform/language[HCL (HashiCorp Configuration Language)], which is declarative. Here are the main building blocks of a Terraform configuration:
28
+
Terraform configurations are written in link:https://developer.hashicorp.com/terraform/language[HCL (HashiCorp Configuration Language)^], which is declarative. Here are the main building blocks of a Terraform configuration:
=== Manage Schema Registry and Schema Registry ACLs
430
+
431
+
You can also use Terraform to manage data plane resources, such as schemas and access controls, through the Redpanda Schema Registry.
432
+
433
+
The Redpanda Schema Registry provides centralized management of schemas for producers and consumers, ensuring compatibility and consistency of data serialized with formats such as Avro, Protobuf, or JSON Schema. Using the Redpanda Terraform provider, you can create, update, and delete schemas as well as manage fine-grained access control for Schema Registry resources.
434
+
435
+
You can use the following Terraform resources:
436
+
437
+
* `redpanda_schema`: Defines and manages schemas in the Schema Registry.
438
+
* `redpanda_schema_registry_acl`: Defines access control policies for Schema Registry subjects or registry-wide operations.
439
+
440
+
==== Create a schema
441
+
442
+
The `redpanda_schema` resource registers a schema in the Redpanda Schema Registry. Each schema is associated with a subject, which serves as the logical namespace for schema versioning. When you create or update a schema, Redpanda validates its compatibility level.
The `redpanda_schema_registry_acl` resource configures fine-grained access control for Schema Registry subjects or registry-wide operations. Each ACL specifies which principal can perform specific operations on a subject or the registry.
principal = "User:${redpanda_user.schema_user.name}"
526
+
resource_type = "SUBJECT" # SUBJECT or REGISTRY
527
+
resource_name = "user_events-value"
528
+
pattern_type = "LITERAL" # LITERAL or PREFIXED
529
+
host = "*"
530
+
operation = "READ" # READ, WRITE, DELETE, DESCRIBE, etc.
531
+
permission = "ALLOW" # ALLOW or DENY
532
+
username = redpanda_user.schema_user.name
533
+
password = var.schema_password
534
+
}
535
+
----
536
+
537
+
In this example:
538
+
539
+
* `cluster_id` identifies the cluster that hosts the Schema Registry.
540
+
* `principal` specifies the user or service account (for example, `User:alice`).
541
+
* `resource_type` determines whether the ACL applies to a specific `SUBJECT` or the entire `REGISTRY`.
542
+
* `resource_name` defines the subject name (use `*` for wildcard).
543
+
* `pattern_type` controls how the resource name is matched (`LITERAL` or `PREFIXED`).
544
+
* `operation` defines the permitted action (`READ`, `WRITE`, `DELETE`, etc.).
545
+
* `permission` defines whether the operation is allowed or denied.
546
+
* `host` specifies the host filter (typically `"*"` for all hosts).
547
+
* `username` and `password` authenticate the principal to the Schema Registry.
548
+
549
+
TIP: To manage Schema Registry ACLs, the user must have cluster-level `ALTER` permissions. This is typically granted through a Kafka ACL with `ALTER` on the `CLUSTER` resource.
550
+
551
+
==== Combine schema and ACLs
552
+
553
+
You can define both the schema and its ACLs in a single configuration to automate schema registration and access setup.
This configuration registers an Avro schema for the `user_events` subject and grants a service account permission to read it from the Schema Registry.
603
+
425
604
== Delete resources
426
605
427
606
Terraform provides a way to clean up your infrastructure when resources are no longer needed. The `terraform destroy` command deletes all the resources defined in your configuration.
@@ -455,4 +634,7 @@ This will delete only the `redpanda_network.example` resource.
0 commit comments