Skip to content

Commit 774ab7b

Browse files
authored
Feat/support mps input output resource (#2199)
* add e2e. * fix golangci-lint issues * support mps input/output resource * add changelog * add e2e case * adjust e2e case
1 parent e9e9539 commit 774ab7b

16 files changed

+2461
-23
lines changed

.changelog/2199.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```release-note:new-resource
2+
tencentcloud_mps_input
3+
```
4+
5+
```release-note:new-resource
6+
tencentcloud_mps_output
7+
```
8+
9+
```release-note:new-resource
10+
tencentcloud_mps_start_flow_operation
11+
```

tencentcloud/extension_mps.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ const (
44
WORKFLOW_STATUS_ENABLED = "Enabled"
55
WORKFLOW_STATUS_DISABLED = "Disabled"
66
)
7+
8+
const (
9+
PROTOCOL_RTP = "RTP"
10+
PROTOCOL_SRT = "SRT"
11+
PROTOCOL_RTMP = "RTMP"
12+
PROTOCOL_HLS = "HLS"
13+
PROTOCOL_RTMP_PULL = "RTMP_PULL"
14+
PROTOCOL_RTSP_PULL = "RTSP_PULL"
15+
PROTOCOL_HLS_PULL = "HLS_PULL"
16+
)

tencentcloud/provider.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,9 @@ Media Processing Service(MPS)
16771677
tencentcloud_mps_schedule
16781678
tencentcloud_mps_enable_schedule_config
16791679
tencentcloud_mps_flow
1680+
tencentcloud_mps_input
1681+
tencentcloud_mps_output
1682+
tencentcloud_mps_start_flow_operation
16801683
tencentcloud_mps_event
16811684
tencentcloud_mps_manage_task_operation
16821685
tencentcloud_mps_execute_function_operation
@@ -3264,6 +3267,8 @@ func Provider() *schema.Provider {
32643267
"tencentcloud_mps_workflow": resourceTencentCloudMpsWorkflow(),
32653268
"tencentcloud_mps_enable_workflow_config": resourceTencentCloudMpsEnableWorkflowConfig(),
32663269
"tencentcloud_mps_flow": resourceTencentCloudMpsFlow(),
3270+
"tencentcloud_mps_input": resourceTencentCloudMpsInput(),
3271+
"tencentcloud_mps_output": resourceTencentCloudMpsOutput(),
32673272
"tencentcloud_mps_start_flow_operation": resourceTencentCloudMpsStartFlowOperation(),
32683273
"tencentcloud_mps_event": resourceTencentCloudMpsEvent(),
32693274
"tencentcloud_mps_execute_function_operation": resourceTencentCloudMpsExecuteFunctionOperation(),

tencentcloud/resource_tc_mps_flow.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,57 @@ resource "tencentcloud_mps_flow" "flow_rtp" {
5757
}
5858
```
5959
60+
Create a mps RTP flow and start it
61+
62+
Before you start a mps flow, you need to create a output first.
63+
64+
```hcl
65+
resource "tencentcloud_mps_event" "event_rtp" {
66+
event_name = "your_event_name"
67+
description = "tf test mps event description"
68+
}
69+
70+
resource "tencentcloud_mps_flow" "flow_rtp" {
71+
flow_name = "your_flow_name"
72+
max_bandwidth = 10000000
73+
input_group {
74+
input_name = "test_inputname"
75+
protocol = "RTP"
76+
description = "input name Description"
77+
allow_ip_list = ["0.0.0.0/0"]
78+
rtp_settings {
79+
fec = "none"
80+
idle_timeout = 1000
81+
}
82+
}
83+
event_id = tencentcloud_mps_event.event_rtp.id
84+
}
85+
86+
resource "tencentcloud_mps_output" "output" {
87+
flow_id = tencentcloud_mps_flow.flow_rtp.id
88+
output {
89+
output_name = "your_output_name"
90+
description = "tf mps output group"
91+
protocol = "RTP"
92+
output_region = "ap-guangzhou"
93+
rtp_settings {
94+
destinations {
95+
ip = "203.205.141.84"
96+
port = 65535
97+
}
98+
fec = "none"
99+
idle_timeout = 1000
100+
}
101+
}
102+
}
103+
104+
resource "tencentcloud_mps_start_flow_operation" "operation" {
105+
flow_id = tencentcloud_mps_flow.flow_rtp.id
106+
start = true
107+
depends_on = [tencentcloud_mps_output.output]
108+
}
109+
```
110+
60111
Import
61112
62113
mps flow can be imported using the id, e.g.
@@ -102,6 +153,7 @@ func resourceTencentCloudMpsFlow() *schema.Resource {
102153

103154
"input_group": {
104155
Optional: true,
156+
Computed: true,
105157
Type: schema.TypeList,
106158
Description: "The input group for the flow.",
107159
Elem: &schema.Resource{

0 commit comments

Comments
 (0)