pulumi-kafka 3.9.0a1736849387__py3-none-any.whl → 3.13.0a1763619276__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pulumi_kafka/__init__.py +4 -1
- pulumi_kafka/_utilities.py +9 -5
- pulumi_kafka/acl.py +293 -242
- pulumi_kafka/config/__init__.py +2 -1
- pulumi_kafka/config/__init__.pyi +28 -4
- pulumi_kafka/config/vars.py +61 -27
- pulumi_kafka/get_topic.py +14 -14
- pulumi_kafka/get_topics.py +85 -0
- pulumi_kafka/outputs.py +71 -0
- pulumi_kafka/provider.py +369 -228
- pulumi_kafka/pulumi-plugin.json +1 -1
- pulumi_kafka/quota.py +289 -79
- pulumi_kafka/topic.py +261 -88
- pulumi_kafka/user_scram_credential.py +202 -87
- {pulumi_kafka-3.9.0a1736849387.dist-info → pulumi_kafka-3.13.0a1763619276.dist-info}/METADATA +4 -4
- pulumi_kafka-3.13.0a1763619276.dist-info/RECORD +19 -0
- {pulumi_kafka-3.9.0a1736849387.dist-info → pulumi_kafka-3.13.0a1763619276.dist-info}/WHEEL +1 -1
- pulumi_kafka-3.9.0a1736849387.dist-info/RECORD +0 -17
- {pulumi_kafka-3.9.0a1736849387.dist-info → pulumi_kafka-3.13.0a1763619276.dist-info}/top_level.txt +0 -0
pulumi_kafka/topic.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
|
-
# *** WARNING: this file was generated by
|
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
|
3
3
|
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import builtins as _builtins
|
|
6
6
|
import warnings
|
|
7
7
|
import sys
|
|
8
8
|
import pulumi
|
|
@@ -19,16 +19,16 @@ __all__ = ['TopicArgs', 'Topic']
|
|
|
19
19
|
@pulumi.input_type
|
|
20
20
|
class TopicArgs:
|
|
21
21
|
def __init__(__self__, *,
|
|
22
|
-
partitions: pulumi.Input[int],
|
|
23
|
-
replication_factor: pulumi.Input[int],
|
|
24
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
25
|
-
name: Optional[pulumi.Input[str]] = None):
|
|
22
|
+
partitions: pulumi.Input[_builtins.int],
|
|
23
|
+
replication_factor: pulumi.Input[_builtins.int],
|
|
24
|
+
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]] = None,
|
|
25
|
+
name: Optional[pulumi.Input[_builtins.str]] = None):
|
|
26
26
|
"""
|
|
27
27
|
The set of arguments for constructing a Topic resource.
|
|
28
|
-
:param pulumi.Input[int] partitions:
|
|
29
|
-
:param pulumi.Input[int] replication_factor:
|
|
30
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
31
|
-
:param pulumi.Input[str] name: The name of the topic.
|
|
28
|
+
:param pulumi.Input[_builtins.int] partitions: Number of partitions.
|
|
29
|
+
:param pulumi.Input[_builtins.int] replication_factor: Number of replicas.
|
|
30
|
+
:param pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]] config: A map of string k/v attributes.
|
|
31
|
+
:param pulumi.Input[_builtins.str] name: The name of the topic.
|
|
32
32
|
"""
|
|
33
33
|
pulumi.set(__self__, "partitions", partitions)
|
|
34
34
|
pulumi.set(__self__, "replication_factor", replication_factor)
|
|
@@ -37,68 +37,68 @@ class TopicArgs:
|
|
|
37
37
|
if name is not None:
|
|
38
38
|
pulumi.set(__self__, "name", name)
|
|
39
39
|
|
|
40
|
-
@property
|
|
40
|
+
@_builtins.property
|
|
41
41
|
@pulumi.getter
|
|
42
|
-
def partitions(self) -> pulumi.Input[int]:
|
|
42
|
+
def partitions(self) -> pulumi.Input[_builtins.int]:
|
|
43
43
|
"""
|
|
44
|
-
|
|
44
|
+
Number of partitions.
|
|
45
45
|
"""
|
|
46
46
|
return pulumi.get(self, "partitions")
|
|
47
47
|
|
|
48
48
|
@partitions.setter
|
|
49
|
-
def partitions(self, value: pulumi.Input[int]):
|
|
49
|
+
def partitions(self, value: pulumi.Input[_builtins.int]):
|
|
50
50
|
pulumi.set(self, "partitions", value)
|
|
51
51
|
|
|
52
|
-
@property
|
|
52
|
+
@_builtins.property
|
|
53
53
|
@pulumi.getter(name="replicationFactor")
|
|
54
|
-
def replication_factor(self) -> pulumi.Input[int]:
|
|
54
|
+
def replication_factor(self) -> pulumi.Input[_builtins.int]:
|
|
55
55
|
"""
|
|
56
|
-
|
|
56
|
+
Number of replicas.
|
|
57
57
|
"""
|
|
58
58
|
return pulumi.get(self, "replication_factor")
|
|
59
59
|
|
|
60
60
|
@replication_factor.setter
|
|
61
|
-
def replication_factor(self, value: pulumi.Input[int]):
|
|
61
|
+
def replication_factor(self, value: pulumi.Input[_builtins.int]):
|
|
62
62
|
pulumi.set(self, "replication_factor", value)
|
|
63
63
|
|
|
64
|
-
@property
|
|
64
|
+
@_builtins.property
|
|
65
65
|
@pulumi.getter
|
|
66
|
-
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
|
|
66
|
+
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]]:
|
|
67
67
|
"""
|
|
68
68
|
A map of string k/v attributes.
|
|
69
69
|
"""
|
|
70
70
|
return pulumi.get(self, "config")
|
|
71
71
|
|
|
72
72
|
@config.setter
|
|
73
|
-
def config(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
|
|
73
|
+
def config(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]]):
|
|
74
74
|
pulumi.set(self, "config", value)
|
|
75
75
|
|
|
76
|
-
@property
|
|
76
|
+
@_builtins.property
|
|
77
77
|
@pulumi.getter
|
|
78
|
-
def name(self) -> Optional[pulumi.Input[str]]:
|
|
78
|
+
def name(self) -> Optional[pulumi.Input[_builtins.str]]:
|
|
79
79
|
"""
|
|
80
80
|
The name of the topic.
|
|
81
81
|
"""
|
|
82
82
|
return pulumi.get(self, "name")
|
|
83
83
|
|
|
84
84
|
@name.setter
|
|
85
|
-
def name(self, value: Optional[pulumi.Input[str]]):
|
|
85
|
+
def name(self, value: Optional[pulumi.Input[_builtins.str]]):
|
|
86
86
|
pulumi.set(self, "name", value)
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
@pulumi.input_type
|
|
90
90
|
class _TopicState:
|
|
91
91
|
def __init__(__self__, *,
|
|
92
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
93
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
94
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
95
|
-
replication_factor: Optional[pulumi.Input[int]] = None):
|
|
92
|
+
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]] = None,
|
|
93
|
+
name: Optional[pulumi.Input[_builtins.str]] = None,
|
|
94
|
+
partitions: Optional[pulumi.Input[_builtins.int]] = None,
|
|
95
|
+
replication_factor: Optional[pulumi.Input[_builtins.int]] = None):
|
|
96
96
|
"""
|
|
97
97
|
Input properties used for looking up and filtering Topic resources.
|
|
98
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
99
|
-
:param pulumi.Input[str] name: The name of the topic.
|
|
100
|
-
:param pulumi.Input[int] partitions:
|
|
101
|
-
:param pulumi.Input[int] replication_factor:
|
|
98
|
+
:param pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]] config: A map of string k/v attributes.
|
|
99
|
+
:param pulumi.Input[_builtins.str] name: The name of the topic.
|
|
100
|
+
:param pulumi.Input[_builtins.int] partitions: Number of partitions.
|
|
101
|
+
:param pulumi.Input[_builtins.int] replication_factor: Number of replicas.
|
|
102
102
|
"""
|
|
103
103
|
if config is not None:
|
|
104
104
|
pulumi.set(__self__, "config", config)
|
|
@@ -109,98 +109,185 @@ class _TopicState:
|
|
|
109
109
|
if replication_factor is not None:
|
|
110
110
|
pulumi.set(__self__, "replication_factor", replication_factor)
|
|
111
111
|
|
|
112
|
-
@property
|
|
112
|
+
@_builtins.property
|
|
113
113
|
@pulumi.getter
|
|
114
|
-
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
|
|
114
|
+
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]]:
|
|
115
115
|
"""
|
|
116
116
|
A map of string k/v attributes.
|
|
117
117
|
"""
|
|
118
118
|
return pulumi.get(self, "config")
|
|
119
119
|
|
|
120
120
|
@config.setter
|
|
121
|
-
def config(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
|
|
121
|
+
def config(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]]):
|
|
122
122
|
pulumi.set(self, "config", value)
|
|
123
123
|
|
|
124
|
-
@property
|
|
124
|
+
@_builtins.property
|
|
125
125
|
@pulumi.getter
|
|
126
|
-
def name(self) -> Optional[pulumi.Input[str]]:
|
|
126
|
+
def name(self) -> Optional[pulumi.Input[_builtins.str]]:
|
|
127
127
|
"""
|
|
128
128
|
The name of the topic.
|
|
129
129
|
"""
|
|
130
130
|
return pulumi.get(self, "name")
|
|
131
131
|
|
|
132
132
|
@name.setter
|
|
133
|
-
def name(self, value: Optional[pulumi.Input[str]]):
|
|
133
|
+
def name(self, value: Optional[pulumi.Input[_builtins.str]]):
|
|
134
134
|
pulumi.set(self, "name", value)
|
|
135
135
|
|
|
136
|
-
@property
|
|
136
|
+
@_builtins.property
|
|
137
137
|
@pulumi.getter
|
|
138
|
-
def partitions(self) -> Optional[pulumi.Input[int]]:
|
|
138
|
+
def partitions(self) -> Optional[pulumi.Input[_builtins.int]]:
|
|
139
139
|
"""
|
|
140
|
-
|
|
140
|
+
Number of partitions.
|
|
141
141
|
"""
|
|
142
142
|
return pulumi.get(self, "partitions")
|
|
143
143
|
|
|
144
144
|
@partitions.setter
|
|
145
|
-
def partitions(self, value: Optional[pulumi.Input[int]]):
|
|
145
|
+
def partitions(self, value: Optional[pulumi.Input[_builtins.int]]):
|
|
146
146
|
pulumi.set(self, "partitions", value)
|
|
147
147
|
|
|
148
|
-
@property
|
|
148
|
+
@_builtins.property
|
|
149
149
|
@pulumi.getter(name="replicationFactor")
|
|
150
|
-
def replication_factor(self) -> Optional[pulumi.Input[int]]:
|
|
150
|
+
def replication_factor(self) -> Optional[pulumi.Input[_builtins.int]]:
|
|
151
151
|
"""
|
|
152
|
-
|
|
152
|
+
Number of replicas.
|
|
153
153
|
"""
|
|
154
154
|
return pulumi.get(self, "replication_factor")
|
|
155
155
|
|
|
156
156
|
@replication_factor.setter
|
|
157
|
-
def replication_factor(self, value: Optional[pulumi.Input[int]]):
|
|
157
|
+
def replication_factor(self, value: Optional[pulumi.Input[_builtins.int]]):
|
|
158
158
|
pulumi.set(self, "replication_factor", value)
|
|
159
159
|
|
|
160
160
|
|
|
161
|
+
@pulumi.type_token("kafka:index/topic:Topic")
|
|
161
162
|
class Topic(pulumi.CustomResource):
|
|
162
163
|
@overload
|
|
163
164
|
def __init__(__self__,
|
|
164
165
|
resource_name: str,
|
|
165
166
|
opts: Optional[pulumi.ResourceOptions] = None,
|
|
166
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
167
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
168
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
169
|
-
replication_factor: Optional[pulumi.Input[int]] = None,
|
|
167
|
+
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]] = None,
|
|
168
|
+
name: Optional[pulumi.Input[_builtins.str]] = None,
|
|
169
|
+
partitions: Optional[pulumi.Input[_builtins.int]] = None,
|
|
170
|
+
replication_factor: Optional[pulumi.Input[_builtins.int]] = None,
|
|
170
171
|
__props__=None):
|
|
171
172
|
"""
|
|
172
|
-
|
|
173
|
+
The `Topic` resource manages Apache Kafka topics, including their partition count, replication factor, and various configuration parameters. This resource supports non-destructive partition count increases.
|
|
173
174
|
|
|
174
175
|
## Example Usage
|
|
175
176
|
|
|
177
|
+
### Basic Topic
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
import pulumi
|
|
181
|
+
import pulumi_kafka as kafka
|
|
182
|
+
|
|
183
|
+
example = kafka.Topic("example",
|
|
184
|
+
name="example-topic",
|
|
185
|
+
replication_factor=3,
|
|
186
|
+
partitions=10)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Topic with Common Configurations
|
|
190
|
+
|
|
176
191
|
```python
|
|
177
192
|
import pulumi
|
|
178
193
|
import pulumi_kafka as kafka
|
|
179
194
|
|
|
180
195
|
logs = kafka.Topic("logs",
|
|
181
|
-
name="
|
|
182
|
-
replication_factor=
|
|
196
|
+
name="application-logs",
|
|
197
|
+
replication_factor=3,
|
|
198
|
+
partitions=50,
|
|
199
|
+
config={
|
|
200
|
+
"retention.ms": "604800000",
|
|
201
|
+
"segment.ms": "86400000",
|
|
202
|
+
"cleanup.policy": "delete",
|
|
203
|
+
"compression.type": "gzip",
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Compacted Topic for Event Sourcing
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
import pulumi
|
|
211
|
+
import pulumi_kafka as kafka
|
|
212
|
+
|
|
213
|
+
events = kafka.Topic("events",
|
|
214
|
+
name="user-events",
|
|
215
|
+
replication_factor=3,
|
|
183
216
|
partitions=100,
|
|
184
217
|
config={
|
|
185
|
-
"segment.ms": "20000",
|
|
186
218
|
"cleanup.policy": "compact",
|
|
219
|
+
"retention.ms": "-1",
|
|
220
|
+
"min.compaction.lag.ms": "3600000",
|
|
221
|
+
"delete.retention.ms": "86400000",
|
|
222
|
+
"compression.type": "lz4",
|
|
223
|
+
"segment.bytes": "1073741824",
|
|
187
224
|
})
|
|
188
225
|
```
|
|
189
226
|
|
|
227
|
+
### High-Throughput Topic
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
import pulumi
|
|
231
|
+
import pulumi_kafka as kafka
|
|
232
|
+
|
|
233
|
+
metrics = kafka.Topic("metrics",
|
|
234
|
+
name="system-metrics",
|
|
235
|
+
replication_factor=2,
|
|
236
|
+
partitions=200,
|
|
237
|
+
config={
|
|
238
|
+
"retention.ms": "86400000",
|
|
239
|
+
"segment.ms": "3600000",
|
|
240
|
+
"compression.type": "lz4",
|
|
241
|
+
"max.message.bytes": "1048576",
|
|
242
|
+
"min.insync.replicas": "2",
|
|
243
|
+
"unclean.leader.election.enable": "false",
|
|
244
|
+
})
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Configuration Parameters
|
|
248
|
+
|
|
249
|
+
The `config` map supports all Kafka topic-level configurations. Common configurations include:
|
|
250
|
+
|
|
251
|
+
### Retention Settings
|
|
252
|
+
- `retention.ms` - How long to retain messages (in milliseconds). Default: 604800000 (7 days)
|
|
253
|
+
- `retention.bytes` - Maximum size of the log before deleting old segments. Default: -1 (no limit)
|
|
254
|
+
- `segment.ms` - Time after which a log segment should be rotated. Default: 604800000 (7 days)
|
|
255
|
+
- `segment.bytes` - Maximum size of a single log segment file. Default: 1073741824 (1GB)
|
|
256
|
+
|
|
257
|
+
### Cleanup and Compaction
|
|
258
|
+
- `cleanup.policy` - Either "delete" or "compact" or both "compact,delete". Default: "delete"
|
|
259
|
+
- `min.compaction.lag.ms` - Minimum time a message will remain uncompacted. Default: 0
|
|
260
|
+
- `delete.retention.ms` - How long to retain delete tombstone markers for compacted topics. Default: 86400000 (1 day)
|
|
261
|
+
|
|
262
|
+
### Compression
|
|
263
|
+
- `compression.type` - Compression codec: "uncompressed", "zstd", "lz4", "snappy", "gzip", "producer". Default: "producer"
|
|
264
|
+
|
|
265
|
+
### Replication and Durability
|
|
266
|
+
- `min.insync.replicas` - Minimum number of replicas that must acknowledge a write. Default: 1
|
|
267
|
+
- `unclean.leader.election.enable` - Whether to allow replicas not in ISR to be elected leader. Default: false
|
|
268
|
+
|
|
269
|
+
### Message Size
|
|
270
|
+
- `max.message.bytes` - Maximum size of a message. Default: 1048588 (~1MB)
|
|
271
|
+
- `message.timestamp.type` - Whether to use CreateTime or LogAppendTime. Default: "CreateTime"
|
|
272
|
+
|
|
273
|
+
For a complete list of configurations, refer to the [Kafka documentation](https://kafka.apache.org/documentation/#topicconfigs).
|
|
274
|
+
|
|
275
|
+
> **Note:** Increasing the partition count is supported without recreating the topic. However, decreasing partitions requires topic recreation.
|
|
276
|
+
|
|
190
277
|
## Import
|
|
191
278
|
|
|
192
|
-
|
|
279
|
+
Existing Kafka topics can be imported using the topic name:
|
|
193
280
|
|
|
194
281
|
```sh
|
|
195
|
-
$ pulumi import kafka:index/topic:Topic
|
|
282
|
+
$ pulumi import kafka:index/topic:Topic example example-topic
|
|
196
283
|
```
|
|
197
284
|
|
|
198
285
|
:param str resource_name: The name of the resource.
|
|
199
286
|
:param pulumi.ResourceOptions opts: Options for the resource.
|
|
200
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
201
|
-
:param pulumi.Input[str] name: The name of the topic.
|
|
202
|
-
:param pulumi.Input[int] partitions:
|
|
203
|
-
:param pulumi.Input[int] replication_factor:
|
|
287
|
+
:param pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]] config: A map of string k/v attributes.
|
|
288
|
+
:param pulumi.Input[_builtins.str] name: The name of the topic.
|
|
289
|
+
:param pulumi.Input[_builtins.int] partitions: Number of partitions.
|
|
290
|
+
:param pulumi.Input[_builtins.int] replication_factor: Number of replicas.
|
|
204
291
|
"""
|
|
205
292
|
...
|
|
206
293
|
@overload
|
|
@@ -209,30 +296,116 @@ class Topic(pulumi.CustomResource):
|
|
|
209
296
|
args: TopicArgs,
|
|
210
297
|
opts: Optional[pulumi.ResourceOptions] = None):
|
|
211
298
|
"""
|
|
212
|
-
|
|
299
|
+
The `Topic` resource manages Apache Kafka topics, including their partition count, replication factor, and various configuration parameters. This resource supports non-destructive partition count increases.
|
|
213
300
|
|
|
214
301
|
## Example Usage
|
|
215
302
|
|
|
303
|
+
### Basic Topic
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
import pulumi
|
|
307
|
+
import pulumi_kafka as kafka
|
|
308
|
+
|
|
309
|
+
example = kafka.Topic("example",
|
|
310
|
+
name="example-topic",
|
|
311
|
+
replication_factor=3,
|
|
312
|
+
partitions=10)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Topic with Common Configurations
|
|
316
|
+
|
|
216
317
|
```python
|
|
217
318
|
import pulumi
|
|
218
319
|
import pulumi_kafka as kafka
|
|
219
320
|
|
|
220
321
|
logs = kafka.Topic("logs",
|
|
221
|
-
name="
|
|
222
|
-
replication_factor=
|
|
322
|
+
name="application-logs",
|
|
323
|
+
replication_factor=3,
|
|
324
|
+
partitions=50,
|
|
325
|
+
config={
|
|
326
|
+
"retention.ms": "604800000",
|
|
327
|
+
"segment.ms": "86400000",
|
|
328
|
+
"cleanup.policy": "delete",
|
|
329
|
+
"compression.type": "gzip",
|
|
330
|
+
})
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Compacted Topic for Event Sourcing
|
|
334
|
+
|
|
335
|
+
```python
|
|
336
|
+
import pulumi
|
|
337
|
+
import pulumi_kafka as kafka
|
|
338
|
+
|
|
339
|
+
events = kafka.Topic("events",
|
|
340
|
+
name="user-events",
|
|
341
|
+
replication_factor=3,
|
|
223
342
|
partitions=100,
|
|
224
343
|
config={
|
|
225
|
-
"segment.ms": "20000",
|
|
226
344
|
"cleanup.policy": "compact",
|
|
345
|
+
"retention.ms": "-1",
|
|
346
|
+
"min.compaction.lag.ms": "3600000",
|
|
347
|
+
"delete.retention.ms": "86400000",
|
|
348
|
+
"compression.type": "lz4",
|
|
349
|
+
"segment.bytes": "1073741824",
|
|
227
350
|
})
|
|
228
351
|
```
|
|
229
352
|
|
|
353
|
+
### High-Throughput Topic
|
|
354
|
+
|
|
355
|
+
```python
|
|
356
|
+
import pulumi
|
|
357
|
+
import pulumi_kafka as kafka
|
|
358
|
+
|
|
359
|
+
metrics = kafka.Topic("metrics",
|
|
360
|
+
name="system-metrics",
|
|
361
|
+
replication_factor=2,
|
|
362
|
+
partitions=200,
|
|
363
|
+
config={
|
|
364
|
+
"retention.ms": "86400000",
|
|
365
|
+
"segment.ms": "3600000",
|
|
366
|
+
"compression.type": "lz4",
|
|
367
|
+
"max.message.bytes": "1048576",
|
|
368
|
+
"min.insync.replicas": "2",
|
|
369
|
+
"unclean.leader.election.enable": "false",
|
|
370
|
+
})
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## Configuration Parameters
|
|
374
|
+
|
|
375
|
+
The `config` map supports all Kafka topic-level configurations. Common configurations include:
|
|
376
|
+
|
|
377
|
+
### Retention Settings
|
|
378
|
+
- `retention.ms` - How long to retain messages (in milliseconds). Default: 604800000 (7 days)
|
|
379
|
+
- `retention.bytes` - Maximum size of the log before deleting old segments. Default: -1 (no limit)
|
|
380
|
+
- `segment.ms` - Time after which a log segment should be rotated. Default: 604800000 (7 days)
|
|
381
|
+
- `segment.bytes` - Maximum size of a single log segment file. Default: 1073741824 (1GB)
|
|
382
|
+
|
|
383
|
+
### Cleanup and Compaction
|
|
384
|
+
- `cleanup.policy` - Either "delete" or "compact" or both "compact,delete". Default: "delete"
|
|
385
|
+
- `min.compaction.lag.ms` - Minimum time a message will remain uncompacted. Default: 0
|
|
386
|
+
- `delete.retention.ms` - How long to retain delete tombstone markers for compacted topics. Default: 86400000 (1 day)
|
|
387
|
+
|
|
388
|
+
### Compression
|
|
389
|
+
- `compression.type` - Compression codec: "uncompressed", "zstd", "lz4", "snappy", "gzip", "producer". Default: "producer"
|
|
390
|
+
|
|
391
|
+
### Replication and Durability
|
|
392
|
+
- `min.insync.replicas` - Minimum number of replicas that must acknowledge a write. Default: 1
|
|
393
|
+
- `unclean.leader.election.enable` - Whether to allow replicas not in ISR to be elected leader. Default: false
|
|
394
|
+
|
|
395
|
+
### Message Size
|
|
396
|
+
- `max.message.bytes` - Maximum size of a message. Default: 1048588 (~1MB)
|
|
397
|
+
- `message.timestamp.type` - Whether to use CreateTime or LogAppendTime. Default: "CreateTime"
|
|
398
|
+
|
|
399
|
+
For a complete list of configurations, refer to the [Kafka documentation](https://kafka.apache.org/documentation/#topicconfigs).
|
|
400
|
+
|
|
401
|
+
> **Note:** Increasing the partition count is supported without recreating the topic. However, decreasing partitions requires topic recreation.
|
|
402
|
+
|
|
230
403
|
## Import
|
|
231
404
|
|
|
232
|
-
|
|
405
|
+
Existing Kafka topics can be imported using the topic name:
|
|
233
406
|
|
|
234
407
|
```sh
|
|
235
|
-
$ pulumi import kafka:index/topic:Topic
|
|
408
|
+
$ pulumi import kafka:index/topic:Topic example example-topic
|
|
236
409
|
```
|
|
237
410
|
|
|
238
411
|
:param str resource_name: The name of the resource.
|
|
@@ -250,10 +423,10 @@ class Topic(pulumi.CustomResource):
|
|
|
250
423
|
def _internal_init(__self__,
|
|
251
424
|
resource_name: str,
|
|
252
425
|
opts: Optional[pulumi.ResourceOptions] = None,
|
|
253
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
254
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
255
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
256
|
-
replication_factor: Optional[pulumi.Input[int]] = None,
|
|
426
|
+
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]] = None,
|
|
427
|
+
name: Optional[pulumi.Input[_builtins.str]] = None,
|
|
428
|
+
partitions: Optional[pulumi.Input[_builtins.int]] = None,
|
|
429
|
+
replication_factor: Optional[pulumi.Input[_builtins.int]] = None,
|
|
257
430
|
__props__=None):
|
|
258
431
|
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
|
|
259
432
|
if not isinstance(opts, pulumi.ResourceOptions):
|
|
@@ -281,10 +454,10 @@ class Topic(pulumi.CustomResource):
|
|
|
281
454
|
def get(resource_name: str,
|
|
282
455
|
id: pulumi.Input[str],
|
|
283
456
|
opts: Optional[pulumi.ResourceOptions] = None,
|
|
284
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
285
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
286
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
287
|
-
replication_factor: Optional[pulumi.Input[int]] = None) -> 'Topic':
|
|
457
|
+
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]] = None,
|
|
458
|
+
name: Optional[pulumi.Input[_builtins.str]] = None,
|
|
459
|
+
partitions: Optional[pulumi.Input[_builtins.int]] = None,
|
|
460
|
+
replication_factor: Optional[pulumi.Input[_builtins.int]] = None) -> 'Topic':
|
|
288
461
|
"""
|
|
289
462
|
Get an existing Topic resource's state with the given name, id, and optional extra
|
|
290
463
|
properties used to qualify the lookup.
|
|
@@ -292,10 +465,10 @@ class Topic(pulumi.CustomResource):
|
|
|
292
465
|
:param str resource_name: The unique name of the resulting resource.
|
|
293
466
|
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
|
|
294
467
|
:param pulumi.ResourceOptions opts: Options for the resource.
|
|
295
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
296
|
-
:param pulumi.Input[str] name: The name of the topic.
|
|
297
|
-
:param pulumi.Input[int] partitions:
|
|
298
|
-
:param pulumi.Input[int] replication_factor:
|
|
468
|
+
:param pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]] config: A map of string k/v attributes.
|
|
469
|
+
:param pulumi.Input[_builtins.str] name: The name of the topic.
|
|
470
|
+
:param pulumi.Input[_builtins.int] partitions: Number of partitions.
|
|
471
|
+
:param pulumi.Input[_builtins.int] replication_factor: Number of replicas.
|
|
299
472
|
"""
|
|
300
473
|
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
|
|
301
474
|
|
|
@@ -307,35 +480,35 @@ class Topic(pulumi.CustomResource):
|
|
|
307
480
|
__props__.__dict__["replication_factor"] = replication_factor
|
|
308
481
|
return Topic(resource_name, opts=opts, __props__=__props__)
|
|
309
482
|
|
|
310
|
-
@property
|
|
483
|
+
@_builtins.property
|
|
311
484
|
@pulumi.getter
|
|
312
|
-
def config(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
|
|
485
|
+
def config(self) -> pulumi.Output[Optional[Mapping[str, _builtins.str]]]:
|
|
313
486
|
"""
|
|
314
487
|
A map of string k/v attributes.
|
|
315
488
|
"""
|
|
316
489
|
return pulumi.get(self, "config")
|
|
317
490
|
|
|
318
|
-
@property
|
|
491
|
+
@_builtins.property
|
|
319
492
|
@pulumi.getter
|
|
320
|
-
def name(self) -> pulumi.Output[str]:
|
|
493
|
+
def name(self) -> pulumi.Output[_builtins.str]:
|
|
321
494
|
"""
|
|
322
495
|
The name of the topic.
|
|
323
496
|
"""
|
|
324
497
|
return pulumi.get(self, "name")
|
|
325
498
|
|
|
326
|
-
@property
|
|
499
|
+
@_builtins.property
|
|
327
500
|
@pulumi.getter
|
|
328
|
-
def partitions(self) -> pulumi.Output[int]:
|
|
501
|
+
def partitions(self) -> pulumi.Output[_builtins.int]:
|
|
329
502
|
"""
|
|
330
|
-
|
|
503
|
+
Number of partitions.
|
|
331
504
|
"""
|
|
332
505
|
return pulumi.get(self, "partitions")
|
|
333
506
|
|
|
334
|
-
@property
|
|
507
|
+
@_builtins.property
|
|
335
508
|
@pulumi.getter(name="replicationFactor")
|
|
336
|
-
def replication_factor(self) -> pulumi.Output[int]:
|
|
509
|
+
def replication_factor(self) -> pulumi.Output[_builtins.int]:
|
|
337
510
|
"""
|
|
338
|
-
|
|
511
|
+
Number of replicas.
|
|
339
512
|
"""
|
|
340
513
|
return pulumi.get(self, "replication_factor")
|
|
341
514
|
|