pulumi-kafka 3.8.0a1723819820__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 +10 -6
- pulumi_kafka/acl.py +298 -242
- pulumi_kafka/config/__init__.py +2 -1
- pulumi_kafka/config/__init__.pyi +48 -4
- pulumi_kafka/config/vars.py +84 -24
- pulumi_kafka/get_topic.py +30 -19
- pulumi_kafka/get_topics.py +85 -0
- pulumi_kafka/outputs.py +71 -0
- pulumi_kafka/provider.py +428 -198
- pulumi_kafka/pulumi-plugin.json +1 -1
- pulumi_kafka/quota.py +294 -79
- pulumi_kafka/topic.py +266 -88
- pulumi_kafka/user_scram_credential.py +207 -87
- {pulumi_kafka-3.8.0a1723819820.dist-info → pulumi_kafka-3.13.0a1763619276.dist-info}/METADATA +7 -6
- pulumi_kafka-3.13.0a1763619276.dist-info/RECORD +19 -0
- {pulumi_kafka-3.8.0a1723819820.dist-info → pulumi_kafka-3.13.0a1763619276.dist-info}/WHEEL +1 -1
- pulumi_kafka-3.8.0a1723819820.dist-info/RECORD +0 -17
- {pulumi_kafka-3.8.0a1723819820.dist-info → pulumi_kafka-3.13.0a1763619276.dist-info}/top_level.txt +0 -0
pulumi_kafka/topic.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
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
|
+
import sys
|
|
7
8
|
import pulumi
|
|
8
9
|
import pulumi.runtime
|
|
9
10
|
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
|
11
|
+
if sys.version_info >= (3, 11):
|
|
12
|
+
from typing import NotRequired, TypedDict, TypeAlias
|
|
13
|
+
else:
|
|
14
|
+
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
|
10
15
|
from . import _utilities
|
|
11
16
|
|
|
12
17
|
__all__ = ['TopicArgs', 'Topic']
|
|
@@ -14,16 +19,16 @@ __all__ = ['TopicArgs', 'Topic']
|
|
|
14
19
|
@pulumi.input_type
|
|
15
20
|
class TopicArgs:
|
|
16
21
|
def __init__(__self__, *,
|
|
17
|
-
partitions: pulumi.Input[int],
|
|
18
|
-
replication_factor: pulumi.Input[int],
|
|
19
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
20
|
-
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):
|
|
21
26
|
"""
|
|
22
27
|
The set of arguments for constructing a Topic resource.
|
|
23
|
-
:param pulumi.Input[int] partitions:
|
|
24
|
-
:param pulumi.Input[int] replication_factor:
|
|
25
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
26
|
-
: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.
|
|
27
32
|
"""
|
|
28
33
|
pulumi.set(__self__, "partitions", partitions)
|
|
29
34
|
pulumi.set(__self__, "replication_factor", replication_factor)
|
|
@@ -32,68 +37,68 @@ class TopicArgs:
|
|
|
32
37
|
if name is not None:
|
|
33
38
|
pulumi.set(__self__, "name", name)
|
|
34
39
|
|
|
35
|
-
@property
|
|
40
|
+
@_builtins.property
|
|
36
41
|
@pulumi.getter
|
|
37
|
-
def partitions(self) -> pulumi.Input[int]:
|
|
42
|
+
def partitions(self) -> pulumi.Input[_builtins.int]:
|
|
38
43
|
"""
|
|
39
|
-
|
|
44
|
+
Number of partitions.
|
|
40
45
|
"""
|
|
41
46
|
return pulumi.get(self, "partitions")
|
|
42
47
|
|
|
43
48
|
@partitions.setter
|
|
44
|
-
def partitions(self, value: pulumi.Input[int]):
|
|
49
|
+
def partitions(self, value: pulumi.Input[_builtins.int]):
|
|
45
50
|
pulumi.set(self, "partitions", value)
|
|
46
51
|
|
|
47
|
-
@property
|
|
52
|
+
@_builtins.property
|
|
48
53
|
@pulumi.getter(name="replicationFactor")
|
|
49
|
-
def replication_factor(self) -> pulumi.Input[int]:
|
|
54
|
+
def replication_factor(self) -> pulumi.Input[_builtins.int]:
|
|
50
55
|
"""
|
|
51
|
-
|
|
56
|
+
Number of replicas.
|
|
52
57
|
"""
|
|
53
58
|
return pulumi.get(self, "replication_factor")
|
|
54
59
|
|
|
55
60
|
@replication_factor.setter
|
|
56
|
-
def replication_factor(self, value: pulumi.Input[int]):
|
|
61
|
+
def replication_factor(self, value: pulumi.Input[_builtins.int]):
|
|
57
62
|
pulumi.set(self, "replication_factor", value)
|
|
58
63
|
|
|
59
|
-
@property
|
|
64
|
+
@_builtins.property
|
|
60
65
|
@pulumi.getter
|
|
61
|
-
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
|
|
66
|
+
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]]:
|
|
62
67
|
"""
|
|
63
68
|
A map of string k/v attributes.
|
|
64
69
|
"""
|
|
65
70
|
return pulumi.get(self, "config")
|
|
66
71
|
|
|
67
72
|
@config.setter
|
|
68
|
-
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]]]]):
|
|
69
74
|
pulumi.set(self, "config", value)
|
|
70
75
|
|
|
71
|
-
@property
|
|
76
|
+
@_builtins.property
|
|
72
77
|
@pulumi.getter
|
|
73
|
-
def name(self) -> Optional[pulumi.Input[str]]:
|
|
78
|
+
def name(self) -> Optional[pulumi.Input[_builtins.str]]:
|
|
74
79
|
"""
|
|
75
80
|
The name of the topic.
|
|
76
81
|
"""
|
|
77
82
|
return pulumi.get(self, "name")
|
|
78
83
|
|
|
79
84
|
@name.setter
|
|
80
|
-
def name(self, value: Optional[pulumi.Input[str]]):
|
|
85
|
+
def name(self, value: Optional[pulumi.Input[_builtins.str]]):
|
|
81
86
|
pulumi.set(self, "name", value)
|
|
82
87
|
|
|
83
88
|
|
|
84
89
|
@pulumi.input_type
|
|
85
90
|
class _TopicState:
|
|
86
91
|
def __init__(__self__, *,
|
|
87
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
88
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
89
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
90
|
-
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):
|
|
91
96
|
"""
|
|
92
97
|
Input properties used for looking up and filtering Topic resources.
|
|
93
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
94
|
-
:param pulumi.Input[str] name: The name of the topic.
|
|
95
|
-
:param pulumi.Input[int] partitions:
|
|
96
|
-
: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.
|
|
97
102
|
"""
|
|
98
103
|
if config is not None:
|
|
99
104
|
pulumi.set(__self__, "config", config)
|
|
@@ -104,98 +109,185 @@ class _TopicState:
|
|
|
104
109
|
if replication_factor is not None:
|
|
105
110
|
pulumi.set(__self__, "replication_factor", replication_factor)
|
|
106
111
|
|
|
107
|
-
@property
|
|
112
|
+
@_builtins.property
|
|
108
113
|
@pulumi.getter
|
|
109
|
-
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
|
|
114
|
+
def config(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[_builtins.str]]]]:
|
|
110
115
|
"""
|
|
111
116
|
A map of string k/v attributes.
|
|
112
117
|
"""
|
|
113
118
|
return pulumi.get(self, "config")
|
|
114
119
|
|
|
115
120
|
@config.setter
|
|
116
|
-
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]]]]):
|
|
117
122
|
pulumi.set(self, "config", value)
|
|
118
123
|
|
|
119
|
-
@property
|
|
124
|
+
@_builtins.property
|
|
120
125
|
@pulumi.getter
|
|
121
|
-
def name(self) -> Optional[pulumi.Input[str]]:
|
|
126
|
+
def name(self) -> Optional[pulumi.Input[_builtins.str]]:
|
|
122
127
|
"""
|
|
123
128
|
The name of the topic.
|
|
124
129
|
"""
|
|
125
130
|
return pulumi.get(self, "name")
|
|
126
131
|
|
|
127
132
|
@name.setter
|
|
128
|
-
def name(self, value: Optional[pulumi.Input[str]]):
|
|
133
|
+
def name(self, value: Optional[pulumi.Input[_builtins.str]]):
|
|
129
134
|
pulumi.set(self, "name", value)
|
|
130
135
|
|
|
131
|
-
@property
|
|
136
|
+
@_builtins.property
|
|
132
137
|
@pulumi.getter
|
|
133
|
-
def partitions(self) -> Optional[pulumi.Input[int]]:
|
|
138
|
+
def partitions(self) -> Optional[pulumi.Input[_builtins.int]]:
|
|
134
139
|
"""
|
|
135
|
-
|
|
140
|
+
Number of partitions.
|
|
136
141
|
"""
|
|
137
142
|
return pulumi.get(self, "partitions")
|
|
138
143
|
|
|
139
144
|
@partitions.setter
|
|
140
|
-
def partitions(self, value: Optional[pulumi.Input[int]]):
|
|
145
|
+
def partitions(self, value: Optional[pulumi.Input[_builtins.int]]):
|
|
141
146
|
pulumi.set(self, "partitions", value)
|
|
142
147
|
|
|
143
|
-
@property
|
|
148
|
+
@_builtins.property
|
|
144
149
|
@pulumi.getter(name="replicationFactor")
|
|
145
|
-
def replication_factor(self) -> Optional[pulumi.Input[int]]:
|
|
150
|
+
def replication_factor(self) -> Optional[pulumi.Input[_builtins.int]]:
|
|
146
151
|
"""
|
|
147
|
-
|
|
152
|
+
Number of replicas.
|
|
148
153
|
"""
|
|
149
154
|
return pulumi.get(self, "replication_factor")
|
|
150
155
|
|
|
151
156
|
@replication_factor.setter
|
|
152
|
-
def replication_factor(self, value: Optional[pulumi.Input[int]]):
|
|
157
|
+
def replication_factor(self, value: Optional[pulumi.Input[_builtins.int]]):
|
|
153
158
|
pulumi.set(self, "replication_factor", value)
|
|
154
159
|
|
|
155
160
|
|
|
161
|
+
@pulumi.type_token("kafka:index/topic:Topic")
|
|
156
162
|
class Topic(pulumi.CustomResource):
|
|
157
163
|
@overload
|
|
158
164
|
def __init__(__self__,
|
|
159
165
|
resource_name: str,
|
|
160
166
|
opts: Optional[pulumi.ResourceOptions] = None,
|
|
161
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
162
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
163
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
164
|
-
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,
|
|
165
171
|
__props__=None):
|
|
166
172
|
"""
|
|
167
|
-
|
|
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.
|
|
168
174
|
|
|
169
175
|
## Example Usage
|
|
170
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
|
+
|
|
171
191
|
```python
|
|
172
192
|
import pulumi
|
|
173
193
|
import pulumi_kafka as kafka
|
|
174
194
|
|
|
175
195
|
logs = kafka.Topic("logs",
|
|
176
|
-
name="
|
|
177
|
-
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,
|
|
178
216
|
partitions=100,
|
|
179
217
|
config={
|
|
180
|
-
"segment.ms": "20000",
|
|
181
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",
|
|
182
224
|
})
|
|
183
225
|
```
|
|
184
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
|
+
|
|
185
277
|
## Import
|
|
186
278
|
|
|
187
|
-
|
|
279
|
+
Existing Kafka topics can be imported using the topic name:
|
|
188
280
|
|
|
189
281
|
```sh
|
|
190
|
-
$ pulumi import kafka:index/topic:Topic
|
|
282
|
+
$ pulumi import kafka:index/topic:Topic example example-topic
|
|
191
283
|
```
|
|
192
284
|
|
|
193
285
|
:param str resource_name: The name of the resource.
|
|
194
286
|
:param pulumi.ResourceOptions opts: Options for the resource.
|
|
195
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
196
|
-
:param pulumi.Input[str] name: The name of the topic.
|
|
197
|
-
:param pulumi.Input[int] partitions:
|
|
198
|
-
: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.
|
|
199
291
|
"""
|
|
200
292
|
...
|
|
201
293
|
@overload
|
|
@@ -204,30 +296,116 @@ class Topic(pulumi.CustomResource):
|
|
|
204
296
|
args: TopicArgs,
|
|
205
297
|
opts: Optional[pulumi.ResourceOptions] = None):
|
|
206
298
|
"""
|
|
207
|
-
|
|
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.
|
|
208
300
|
|
|
209
301
|
## Example Usage
|
|
210
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
|
+
|
|
211
317
|
```python
|
|
212
318
|
import pulumi
|
|
213
319
|
import pulumi_kafka as kafka
|
|
214
320
|
|
|
215
321
|
logs = kafka.Topic("logs",
|
|
216
|
-
name="
|
|
217
|
-
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,
|
|
218
342
|
partitions=100,
|
|
219
343
|
config={
|
|
220
|
-
"segment.ms": "20000",
|
|
221
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",
|
|
222
350
|
})
|
|
223
351
|
```
|
|
224
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
|
+
|
|
225
403
|
## Import
|
|
226
404
|
|
|
227
|
-
|
|
405
|
+
Existing Kafka topics can be imported using the topic name:
|
|
228
406
|
|
|
229
407
|
```sh
|
|
230
|
-
$ pulumi import kafka:index/topic:Topic
|
|
408
|
+
$ pulumi import kafka:index/topic:Topic example example-topic
|
|
231
409
|
```
|
|
232
410
|
|
|
233
411
|
:param str resource_name: The name of the resource.
|
|
@@ -245,10 +423,10 @@ class Topic(pulumi.CustomResource):
|
|
|
245
423
|
def _internal_init(__self__,
|
|
246
424
|
resource_name: str,
|
|
247
425
|
opts: Optional[pulumi.ResourceOptions] = None,
|
|
248
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
249
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
250
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
251
|
-
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,
|
|
252
430
|
__props__=None):
|
|
253
431
|
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
|
|
254
432
|
if not isinstance(opts, pulumi.ResourceOptions):
|
|
@@ -276,10 +454,10 @@ class Topic(pulumi.CustomResource):
|
|
|
276
454
|
def get(resource_name: str,
|
|
277
455
|
id: pulumi.Input[str],
|
|
278
456
|
opts: Optional[pulumi.ResourceOptions] = None,
|
|
279
|
-
config: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
|
|
280
|
-
name: Optional[pulumi.Input[str]] = None,
|
|
281
|
-
partitions: Optional[pulumi.Input[int]] = None,
|
|
282
|
-
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':
|
|
283
461
|
"""
|
|
284
462
|
Get an existing Topic resource's state with the given name, id, and optional extra
|
|
285
463
|
properties used to qualify the lookup.
|
|
@@ -287,10 +465,10 @@ class Topic(pulumi.CustomResource):
|
|
|
287
465
|
:param str resource_name: The unique name of the resulting resource.
|
|
288
466
|
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
|
|
289
467
|
:param pulumi.ResourceOptions opts: Options for the resource.
|
|
290
|
-
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] config: A map of string k/v attributes.
|
|
291
|
-
:param pulumi.Input[str] name: The name of the topic.
|
|
292
|
-
:param pulumi.Input[int] partitions:
|
|
293
|
-
: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.
|
|
294
472
|
"""
|
|
295
473
|
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
|
|
296
474
|
|
|
@@ -302,35 +480,35 @@ class Topic(pulumi.CustomResource):
|
|
|
302
480
|
__props__.__dict__["replication_factor"] = replication_factor
|
|
303
481
|
return Topic(resource_name, opts=opts, __props__=__props__)
|
|
304
482
|
|
|
305
|
-
@property
|
|
483
|
+
@_builtins.property
|
|
306
484
|
@pulumi.getter
|
|
307
|
-
def config(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
|
|
485
|
+
def config(self) -> pulumi.Output[Optional[Mapping[str, _builtins.str]]]:
|
|
308
486
|
"""
|
|
309
487
|
A map of string k/v attributes.
|
|
310
488
|
"""
|
|
311
489
|
return pulumi.get(self, "config")
|
|
312
490
|
|
|
313
|
-
@property
|
|
491
|
+
@_builtins.property
|
|
314
492
|
@pulumi.getter
|
|
315
|
-
def name(self) -> pulumi.Output[str]:
|
|
493
|
+
def name(self) -> pulumi.Output[_builtins.str]:
|
|
316
494
|
"""
|
|
317
495
|
The name of the topic.
|
|
318
496
|
"""
|
|
319
497
|
return pulumi.get(self, "name")
|
|
320
498
|
|
|
321
|
-
@property
|
|
499
|
+
@_builtins.property
|
|
322
500
|
@pulumi.getter
|
|
323
|
-
def partitions(self) -> pulumi.Output[int]:
|
|
501
|
+
def partitions(self) -> pulumi.Output[_builtins.int]:
|
|
324
502
|
"""
|
|
325
|
-
|
|
503
|
+
Number of partitions.
|
|
326
504
|
"""
|
|
327
505
|
return pulumi.get(self, "partitions")
|
|
328
506
|
|
|
329
|
-
@property
|
|
507
|
+
@_builtins.property
|
|
330
508
|
@pulumi.getter(name="replicationFactor")
|
|
331
|
-
def replication_factor(self) -> pulumi.Output[int]:
|
|
509
|
+
def replication_factor(self) -> pulumi.Output[_builtins.int]:
|
|
332
510
|
"""
|
|
333
|
-
|
|
511
|
+
Number of replicas.
|
|
334
512
|
"""
|
|
335
513
|
return pulumi.get(self, "replication_factor")
|
|
336
514
|
|