Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with include_fec attribute not being set #29808

Merged
merged 6 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/29808.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_medialive_channel: Fix setting of the `include_fec` attribute in `fec_output_settings`
```
Original file line number Diff line number Diff line change
Expand Up @@ -3938,7 +3938,7 @@ func expandFecOutputSettings(tfList []interface{}) *types.FecOutputSettings {
if v, ok := m["column_depth"].(int); ok {
settings.ColumnDepth = int32(v)
}
if v, ok := m["column_depth"].(string); ok && v != "" {
if v, ok := m["include_fec"].(string); ok && v != "" {
settings.IncludeFec = types.FecOutputIncludeFec(v)
}
if v, ok := m["row_length"].(int); ok {
Expand Down
148 changes: 148 additions & 0 deletions internal/service/medialive/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,68 @@ func TestAccMediaLiveChannel_m2ts_settings(t *testing.T) {
})
}

func TestAccMediaLiveChannel_UDP_outputSettings(t *testing.T) {
ctx := acctest.Context(t)
if testing.Short() {
t.Skip("skipping long-running test in short mode")
}

var channel medialive.DescribeChannelOutput
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
resourceName := "aws_medialive_channel.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
acctest.PreCheck(t)
acctest.PreCheckPartitionHasService(t, names.MediaLiveEndpointID)
testAccChannelsPreCheck(ctx, t)
},
ErrorCheck: acctest.ErrorCheck(t, names.MediaLiveEndpointID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckChannelDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccChannelConfig_udpOutputSettings(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckChannelExists(ctx, resourceName, &channel),
resource.TestCheckResourceAttrSet(resourceName, "channel_id"),
resource.TestCheckResourceAttr(resourceName, "channel_class", "STANDARD"),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttrSet(resourceName, "role_arn"),
resource.TestCheckResourceAttr(resourceName, "input_specification.0.codec", "AVC"),
resource.TestCheckResourceAttr(resourceName, "input_specification.0.input_resolution", "HD"),
resource.TestCheckResourceAttr(resourceName, "input_specification.0.maximum_bitrate", "MAX_20_MBPS"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "input_attachments.*", map[string]string{
"input_attachment_name": "example-input1",
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "destinations.*", map[string]string{
"id": rName,
}),
resource.TestCheckResourceAttr(resourceName, "encoder_settings.0.timecode_config.0.source", "EMBEDDED"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.audio_descriptions.*", map[string]string{
"audio_selector_name": rName,
"name": rName,
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.video_descriptions.*", map[string]string{
"name": "test-video-name",
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.output_groups.0.outputs.0.output_settings.0.udp_output_settings.0.fec_output_settings.*", map[string]string{
"include_fec": "COLUMN_AND_ROW",
"column_depth": "5",
"row_length": "5",
}),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"start_channel"},
},
},
})
}

func TestAccMediaLiveChannel_audioDescriptions_codecSettings(t *testing.T) {
ctx := acctest.Context(t)
if testing.Short() {
Expand Down Expand Up @@ -713,6 +775,92 @@ resource "aws_medialive_channel" "test" {
`, rName))
}

func testAccChannelConfig_udpOutputSettings(rName string) string {
return acctest.ConfigCompose(
testAccChannelBaseConfig(rName),
testAccChannelBaseMultiplexConfig(rName),
fmt.Sprintf(`
resource "aws_medialive_channel" "test" {
name = %[1]q
channel_class = "STANDARD"
role_arn = aws_iam_role.test.arn

input_specification {
codec = "AVC"
input_resolution = "HD"
maximum_bitrate = "MAX_20_MBPS"
}

input_attachments {
input_attachment_name = "example-input1"
input_id = aws_medialive_input.test.id
}

destinations {
id = %[1]q

settings {
url = "rtp://localhost:8000"
}

settings {
url = "rtp://localhost:8001"
}
}

encoder_settings {
timecode_config {
source = "EMBEDDED"
}

video_descriptions {
name = "test-video-name"
}

audio_descriptions {
audio_selector_name = %[1]q
name = %[1]q
}

output_groups {
output_group_settings {
udp_group_settings {
input_loss_action = "DROP_TS"
}
}

outputs {
output_name = "test-output-name"
video_description_name = "test-video-name"
audio_description_names = [%[1]q]
output_settings {
udp_output_settings {
destination {
destination_ref_id = %[1]q
}

fec_output_settings {
include_fec = "COLUMN_AND_ROW"
column_depth = 5
row_length = 5
}

container_settings {
m2ts_settings {
audio_buffer_model = "ATSC"
buffer_model = "MULTIPLEX"
rate_mode = "CBR"
}
}
}
}
}
}
}
}
`, rName))
}

func testAccChannelConfig_m2tsSettings(rName string) string {
return acctest.ConfigCompose(
testAccChannelBaseConfig(rName),
Expand Down