@@ -147,6 +147,38 @@ resource "huaweicloud_lts_transfer" "obs_agency" {
147
147
}
148
148
```
149
149
150
+ ### Create a DMS transfer in JSON format
151
+
152
+ ``` hcl
153
+ variable "lts_group_id" {}
154
+ variable "lts_stream_id" {}
155
+ variable "registered_kafka_instance_id" {}
156
+ variable "kafka_topic" {}
157
+
158
+ resource "huaweicloud_lts_transfer" "test" {
159
+ log_group_id = var.lts_group_id
160
+
161
+ log_streams {
162
+ log_stream_id = lts_stream_id
163
+ }
164
+
165
+ log_transfer_info {
166
+ log_transfer_type = "DMS"
167
+ log_transfer_mode = "realTime"
168
+ log_storage_format = "JSON"
169
+ log_transfer_status = "ENABLE"
170
+
171
+ log_transfer_detail {
172
+ kafka_id = var.registered_kafka_instance_id
173
+ kafka_topic = var.kafka_topic
174
+ lts_tags = ["hostName", "collectTime"]
175
+ stream_tags = ["all"]
176
+ struct_fields = ["all"]
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
150
182
## Argument Reference
151
183
152
184
The following arguments are supported:
@@ -293,10 +325,25 @@ The `log_transfer_detail` block supports:
293
325
294
326
-> Before creating a DMS transfer task, register your Kafka instance with Kafka ID and Kafka topic first.
295
327
328
+ * ` lts_tags ` - (Optional, List) Specifies the list of built-in fields and custom tags to be transferred.
329
+ If you want to transfer all built-in and specified fields in the log, you need to set it to ** all** .
330
+
331
+ * ` stream_tags ` - (Optional, List) Specifies the list of stream tag fields to be transferred.
332
+ If you want to transfer all stream tag fields in the log, you need to set it to ** all** .
333
+
334
+ * ` struct_fields ` - (Optional, List) Specifies the list of structured fields to be transferred.
335
+ If you want to transfer all fields in a log in the log, you need to set it to ** all** .
336
+
337
+ -> 1. The ` lts_tags ` , ` stream_tags ` and ` struct_fields ` parameters are valid only for DMS transfer in JSON format.
338
+ At least one of them must be set.
339
+
340
+ * ` invalid_field_value ` - (Optional, String) Specifies the value of the invalid field fill.
341
+
296
342
* ` delivery_tags ` - (Optional, List) The list of tag fields will be delivered when transferring.
297
343
This field must contain the following host information: ** hostIP** , ** hostId** , ** hostName** , ** pathFile** , and ** collectTime** .
298
344
The common fields include ** logStreamName** , ** regionName** , ** logGroupName** , and ** projectId** , which are optional.
299
- The transfer tag: ** streamTag** , which is optional.
345
+ The transfer tag: ** streamTag** , which is optional.
346
+ This parameter is valid only for OBS or DIS transfer in JSON format.
300
347
301
348
## Attribute Reference
302
349
@@ -306,10 +353,31 @@ In addition to all arguments above, the following attributes are exported:
306
353
307
354
* ` log_group_name ` - Log group name.
308
355
356
+ * ` created_at ` - The creation time of the log transfer, in RFC3339 format.
357
+
309
358
## Import
310
359
311
360
The LTS transfer task can be imported using the ` id ` , e.g.
312
361
313
362
``` bash
314
363
$ terraform import huaweicloud_lts_transfer.test < id>
315
364
```
365
+
366
+ Note that the imported state may not be identical to your resource definition, due to some attributes missing from the
367
+ API response.
368
+ The missing attributes include: ` log_transfer_info.0.log_transfer_detail.0.invalid_field_value ` .
369
+ It is generally recommended running ` terraform plan ` after importing the resource.
370
+ You can then decide if changes should be applied to the resource, or the resource definition should be updated to
371
+ align with the resource. Also you can ignore changes as below.
372
+
373
+ ``` hcl
374
+ resource "huaweicloud_lts_transfer" "test" {
375
+ ...
376
+
377
+ lifecycle {
378
+ ignore_changes = [
379
+ log_transfer_info.0.log_transfer_detail.0.invalid_field_value
380
+ ]
381
+ }
382
+ }
383
+ ```
0 commit comments