Skip to content

Commit 2c57ea4

Browse files
tongyimingmikatong
andauthored
fix(vod): [116206298] update vod resource (#2569)
* vod update * add changelog && update doc * update * update * update * update review_audio_video_task * update * update * update --------- Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 0882f12 commit 2c57ea4

21 files changed

+1387
-217
lines changed

.changelog/2569.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_vod_adaptive_dynamic_streaming_template: Add vcrf, gop, preserve_hdr_switch, codec_tag. Adjust resource unique id to subAppId#templateId.
3+
```
4+
5+
```release-note:enhancement
6+
resource/tencentcloud_vod_image_sprite_template: Add format, type. Adjust resource unique id to subAppId#templateId.
7+
```
8+
9+
```release-note:enhancement
10+
resource/tencentcloud_vod_procedure_template: Update params media_process_task, add ai_analysis_task, ai_recognition_task, review_audio_video_task, type. Adjust resource unique id to subAppId#templateId.
11+
```
12+
13+
```release-note:enhancement
14+
resource/tencentcloud_vod_sample_snapshot_template: Adjust resource unique id to subAppId#templateId.
15+
```
16+
17+
```release-note:enhancement
18+
resource/tencentcloud_vod_snapshot_by_time_offset_template: Add type. Adjust resource unique id to subAppId#templateId.
19+
```

tencentcloud/services/vod/resource_tc_vod_adaptive_dynamic_streaming_template.go

Lines changed: 240 additions & 26 deletions
Large diffs are not rendered by default.

tencentcloud/services/vod/resource_tc_vod_adaptive_dynamic_streaming_template.md

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,44 @@ Provide a resource to create a VOD adaptive dynamic streaming template.
33
Example Usage
44

55
```hcl
6+
resource "tencentcloud_vod_sub_application" "sub_application" {
7+
name = "adaptive-subapplication"
8+
status = "On"
9+
description = "this is sub application"
10+
}
11+
612
resource "tencentcloud_vod_adaptive_dynamic_streaming_template" "foo" {
713
format = "HLS"
814
name = "tf-adaptive"
15+
sub_app_id = tonumber(split("#", tencentcloud_vod_sub_application.sub_application.id)[1])
916
drm_type = "SimpleAES"
1017
disable_higher_video_bitrate = false
1118
disable_higher_video_resolution = false
1219
comment = "test"
1320
14-
stream_info {
15-
video {
16-
codec = "libx265"
17-
fps = 4
18-
bitrate = 129
19-
resolution_adaptive = false
20-
width = 128
21-
height = 128
22-
fill_type = "stretch"
23-
}
24-
audio {
25-
codec = "libmp3lame"
26-
bitrate = 129
27-
sample_rate = 44100
28-
audio_channel = "dual"
29-
}
30-
remove_audio = false
31-
}
3221
stream_info {
3322
video {
3423
codec = "libx264"
35-
fps = 4
36-
bitrate = 256
24+
fps = 3
25+
bitrate = 128
3726
}
3827
audio {
3928
codec = "libfdk_aac"
40-
bitrate = 256
41-
sample_rate = 44100
29+
bitrate = 128
30+
sample_rate = 32000
4231
}
4332
remove_audio = true
33+
tehd_config {
34+
type = "TEHD-100"
35+
}
4436
}
4537
}
4638
```
4739

4840
Import
4941

50-
VOD adaptive dynamic streaming template can be imported using the id, e.g.
42+
VOD adaptive dynamic streaming template can be imported using the id($subAppId#$templateId), e.g.
5143

5244
```
53-
$ terraform import tencentcloud_vod_adaptive_dynamic_streaming_template.foo 169141
45+
$ terraform import tencentcloud_vod_adaptive_dynamic_streaming_template.foo $subAppId#$templateId
5446
```

tencentcloud/services/vod/resource_tc_vod_adaptive_dynamic_streaming_template_test.go

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import (
44
"context"
55
"fmt"
66
"strconv"
7+
"strings"
78
"testing"
89

910
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
1011
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
12+
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
1113
svcvod "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/vod"
1214

1315
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -53,7 +55,6 @@ func TestAccTencentCloudVodAdaptiveDynamicStreamingTemplateResource(t *testing.T
5355
{
5456
Config: testAccVodAdaptiveDynamicStreamingTemplate,
5557
Check: resource.ComposeTestCheckFunc(
56-
testAccCheckVodAdaptiveDynamicStreamingTemplateExists("tencentcloud_vod_adaptive_dynamic_streaming_template.foo"),
5758
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "format", "HLS"),
5859
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "name", "tf-adaptive"),
5960
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "drm_type", "SimpleAES"),
@@ -81,6 +82,7 @@ func TestAccTencentCloudVodAdaptiveDynamicStreamingTemplateResource(t *testing.T
8182
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "stream_info.1.remove_audio", "true"),
8283
resource.TestCheckResourceAttrSet("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "create_time"),
8384
resource.TestCheckResourceAttrSet("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "update_time"),
85+
resource.TestCheckResourceAttrSet("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "sub_app_id"),
8486
),
8587
},
8688
{
@@ -104,13 +106,14 @@ func TestAccTencentCloudVodAdaptiveDynamicStreamingTemplateResource(t *testing.T
104106
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "stream_info.0.audio.0.sample_rate", "44100"),
105107
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "stream_info.0.audio.0.audio_channel", "dual"),
106108
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "stream_info.0.remove_audio", "false"),
109+
resource.TestCheckResourceAttrSet("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "sub_app_id"),
110+
resource.TestCheckResourceAttr("tencentcloud_vod_adaptive_dynamic_streaming_template.foo", "stream_info.0.tehd_config.0.type", "TEHD-100"),
107111
),
108112
},
109113
{
110-
ResourceName: "tencentcloud_vod_adaptive_dynamic_streaming_template.foo",
111-
ImportState: true,
112-
ImportStateVerify: true,
113-
ImportStateVerifyIgnore: []string{"sub_app_id"},
114+
ResourceName: "tencentcloud_vod_adaptive_dynamic_streaming_template.foo",
115+
ImportState: true,
116+
ImportStateVerify: true,
114117
},
115118
},
116119
})
@@ -125,11 +128,13 @@ func testAccCheckVodAdaptiveDynamicStreamingTemplateDestroy(s *terraform.State)
125128
if rs.Type != "tencentcloud_vod_adaptive_dynamic_streaming_template" {
126129
continue
127130
}
128-
var (
129-
filter = map[string]interface{}{
130-
"definitions": []string{rs.Primary.ID},
131-
}
132-
)
131+
idSplit := strings.Split(rs.Primary.ID, tccommon.FILED_SP)
132+
subAppId := helper.StrToInt(idSplit[0])
133+
definition := idSplit[1]
134+
filter := map[string]interface{}{
135+
"definitions": []string{definition},
136+
"sub_appid": subAppId,
137+
}
133138

134139
templates, err := vodService.DescribeAdaptiveDynamicStreamingTemplatesByFilter(ctx, filter)
135140
if err != nil {
@@ -156,9 +161,13 @@ func testAccCheckVodAdaptiveDynamicStreamingTemplateExists(n string) resource.Te
156161
return fmt.Errorf("vod adaptive dynamic streaming template id is not set")
157162
}
158163
vodService := svcvod.NewVodService(tcacctest.AccProvider.Meta().(tccommon.ProviderMeta).GetAPIV3Conn())
164+
idSplit := strings.Split(rs.Primary.ID, tccommon.FILED_SP)
165+
subAppId := helper.StrToInt(idSplit[0])
166+
definition := idSplit[1]
159167
var (
160168
filter = map[string]interface{}{
161-
"definitions": []string{rs.Primary.ID},
169+
"definitions": []string{definition},
170+
"sub_appid": subAppId,
162171
}
163172
)
164173

@@ -174,9 +183,16 @@ func testAccCheckVodAdaptiveDynamicStreamingTemplateExists(n string) resource.Te
174183
}
175184

176185
const testAccVodAdaptiveDynamicStreamingTemplate = `
186+
resource "tencentcloud_vod_sub_application" "sub_application" {
187+
name = "adaptive-subapplication"
188+
status = "On"
189+
description = "this is sub application"
190+
}
191+
177192
resource "tencentcloud_vod_adaptive_dynamic_streaming_template" "foo" {
178193
format = "HLS"
179194
name = "tf-adaptive"
195+
sub_app_id = tonumber(split("#", tencentcloud_vod_sub_application.sub_application.id)[1])
180196
drm_type = "SimpleAES"
181197
disable_higher_video_bitrate = false
182198
disable_higher_video_resolution = false
@@ -212,9 +228,16 @@ resource "tencentcloud_vod_adaptive_dynamic_streaming_template" "foo" {
212228
`
213229

214230
const testAccVodAdaptiveDynamicStreamingTemplateUpdate = `
231+
resource "tencentcloud_vod_sub_application" "sub_application" {
232+
name = "adaptive-subapplication"
233+
status = "On"
234+
description = "this is sub application"
235+
}
236+
215237
resource "tencentcloud_vod_adaptive_dynamic_streaming_template" "foo" {
216238
format = "HLS"
217239
name = "tf-adaptive-update"
240+
sub_app_id = tonumber(split("#", tencentcloud_vod_sub_application.sub_application.id)[1])
218241
drm_type = "SimpleAES"
219242
disable_higher_video_bitrate = true
220243
disable_higher_video_resolution = true
@@ -237,6 +260,9 @@ resource "tencentcloud_vod_adaptive_dynamic_streaming_template" "foo" {
237260
audio_channel = "dual"
238261
}
239262
remove_audio = false
263+
tehd_config {
264+
type = "TEHD-100"
265+
}
240266
}
241267
}
242268
`

0 commit comments

Comments
 (0)