diff --git a/.changelog/29807.txt b/.changelog/29807.txt new file mode 100644 index 000000000000..dd0404feb01e --- /dev/null +++ b/.changelog/29807.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_medialive_channel: Fix setting of `bitrate` and `sample_rate` for `aac_settings`. +``` diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index 4199f98ab322..3b26f9cb0699 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -2539,8 +2539,8 @@ func expandAudioDescriptionsCodecSettingsAacSettings(tfList []interface{}) *type m := tfList[0].(map[string]interface{}) var out types.AacSettings - if v, ok := m["bitrate"].(float32); ok { - out.Bitrate = float64(v) + if v, ok := m["bitrate"].(float64); ok { + out.Bitrate = v } if v, ok := m["coding_mode"].(string); ok && v != "" { out.CodingMode = types.AacCodingMode(v) @@ -2557,8 +2557,8 @@ func expandAudioDescriptionsCodecSettingsAacSettings(tfList []interface{}) *type if v, ok := m["raw_format"].(string); ok && v != "" { out.RawFormat = types.AacRawFormat(v) } - if v, ok := m["sample_rate"].(float32); ok { - out.SampleRate = float64(v) + if v, ok := m["sample_rate"].(float64); ok { + out.SampleRate = v } if v, ok := m["spec"].(string); ok && v != "" { out.Spec = types.AacSpec(v) @@ -5535,13 +5535,13 @@ func flattenCodecSettingsAacSettings(in *types.AacSettings) []interface{} { } m := map[string]interface{}{ - "bitrate": float32(in.Bitrate), + "bitrate": in.Bitrate, "coding_mode": string(in.CodingMode), "input_type": string(in.InputType), "profile": string(in.Profile), "rate_control_mode": string(in.RateControlMode), "raw_format": string(in.RawFormat), - "sample_rate": float32(in.SampleRate), + "sample_rate": in.SampleRate, "spec": string(in.Spec), "vbr_quality": string(in.VbrQuality), } diff --git a/internal/service/medialive/channel_test.go b/internal/service/medialive/channel_test.go index 84826c9981b9..5287b2d7da2d 100644 --- a/internal/service/medialive/channel_test.go +++ b/internal/service/medialive/channel_test.go @@ -247,6 +247,8 @@ func TestAccMediaLiveChannel_audioDescriptions_codecSettings(t *testing.T) { "audio_selector_name": rName, "name": rName, "codec_settings.0.aac_settings.0.rate_control_mode": string(types.AacRateControlModeCbr), + "codec_settings.0.aac_settings.0.bitrate": "192000", + "codec_settings.0.aac_settings.0.sample_rate": "48000", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.video_descriptions.*", map[string]string{ "name": "test-video-name", @@ -997,6 +999,8 @@ resource "aws_medialive_channel" "test" { codec_settings { aac_settings { rate_control_mode = "CBR" + bitrate = 192000 + sample_rate = 48000 } } }