Skip to content

Commit c104fce

Browse files
actions-usergene-redpanda
authored andcommitted
Update documentation
1 parent 7e38b80 commit c104fce

File tree

2 files changed

+109
-1
lines changed

2 files changed

+109
-1
lines changed

docs/data-sources/cluster.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,61 @@ data "redpanda_cluster" "example" {
4040
}
4141
```
4242

43+
### Example Usage of a data source BYOC to manage users and ACLs
44+
45+
```terraform
46+
provider "redpanda" {}
47+
48+
variable "cluster_id" {
49+
default = ""
50+
}
51+
data "redpanda_cluster" "test" {
52+
id = var.cluster_id
53+
}
54+
55+
resource "redpanda_user" "test" {
56+
name = var.user_name
57+
password = var.user_pw
58+
mechanism = var.mechanism
59+
cluster_api_url = data.redpanda_cluster.test.cluster_api_url
60+
}
61+
62+
resource "redpanda_acl" "test" {
63+
resource_type = "CLUSTER"
64+
resource_name = "kafka-cluster"
65+
resource_pattern_type = "LITERAL"
66+
principal = "User:${redpanda_user.test.name}"
67+
host = "*"
68+
operation = "ALTER"
69+
permission_type = "ALLOW"
70+
cluster_api_url = data.redpanda_cluster.test.cluster_api_url
71+
}
72+
73+
variable "user_name" {
74+
default = "test-username"
75+
}
76+
77+
variable "user_pw" {
78+
default = "password"
79+
}
80+
81+
variable "mechanism" {
82+
default = "scram-sha-256"
83+
}
84+
85+
variable "topic_name" {
86+
default = "test-topic"
87+
}
88+
89+
variable "partition_count" {
90+
default = 3
91+
}
92+
93+
variable "replication_factor" {
94+
default = 3
95+
}
96+
```
97+
4398
## Limitations
4499

45100
Can only be used with Redpanda Cloud Dedicated and BYOC clusters.

docs/index.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ It is also able to provide management of Kafka resources (topics, ACLs, and more
2020

2121
## Authentication with Redpanda Cloud
2222

23-
This provider requires a `client_id` and `client_secret` for authentication with Redpanda Cloud services, enabling users to securely manage their Redpanda resources. You can get these by creating an account in [Redpanda Cloud](https://cloudv2.redpanda.com/home) and then [creating a client in the ](https://cloudv2.redpanda.com/clients).
23+
This provider requires a `client_id` and `client_secret` for authentication with Redpanda Cloud services, enabling users to securely manage their Redpanda resources. You can get these by creating an account in [Redpanda Cloud](https://cloudv2.redpanda.com/home) and then [creating a client in the Redpanda Cloud UI](https://cloudv2.redpanda.com/clients).
2424

2525
## Example Provider Configuration
2626

@@ -169,4 +169,57 @@ variable "throughput_tier" {
169169
}
170170
```
171171

172+
### Example Usage of a data source BYOC to manage users and ACLs
172173

174+
```terraform
175+
provider "redpanda" {}
176+
177+
variable "cluster_id" {
178+
default = ""
179+
}
180+
data "redpanda_cluster" "test" {
181+
id = var.cluster_id
182+
}
183+
184+
resource "redpanda_user" "test" {
185+
name = var.user_name
186+
password = var.user_pw
187+
mechanism = var.mechanism
188+
cluster_api_url = data.redpanda_cluster.test.cluster_api_url
189+
}
190+
191+
resource "redpanda_acl" "test" {
192+
resource_type = "CLUSTER"
193+
resource_name = "kafka-cluster"
194+
resource_pattern_type = "LITERAL"
195+
principal = "User:${redpanda_user.test.name}"
196+
host = "*"
197+
operation = "ALTER"
198+
permission_type = "ALLOW"
199+
cluster_api_url = data.redpanda_cluster.test.cluster_api_url
200+
}
201+
202+
variable "user_name" {
203+
default = "test-username"
204+
}
205+
206+
variable "user_pw" {
207+
default = "password"
208+
}
209+
210+
variable "mechanism" {
211+
default = "scram-sha-256"
212+
}
213+
214+
variable "topic_name" {
215+
default = "test-topic"
216+
}
217+
218+
variable "partition_count" {
219+
default = 3
220+
}
221+
222+
variable "replication_factor" {
223+
default = 3
224+
}
225+
```

0 commit comments

Comments
 (0)