diff --git a/.changelog/27223.txt b/.changelog/27223.txt new file mode 100644 index 00000000000..69100d669c9 --- /dev/null +++ b/.changelog/27223.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_medialive_multiplex_program: Add ability to update `multiplex_program_settings` in place +``` + +```release-note:note +resource/aws_medialive_multiplex_program: The `statemux_settings` argument has been deprecated. Use the `statmux_settings` argument instead +``` \ No newline at end of file diff --git a/internal/provider/fwprovider/provider.go b/internal/provider/fwprovider/provider.go index 87490a7fa78..c1aeb275c96 100644 --- a/internal/provider/fwprovider/provider.go +++ b/internal/provider/fwprovider/provider.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/experimental/intf" "github.com/hashicorp/terraform-provider-aws/internal/fwtypes" + "github.com/hashicorp/terraform-provider-aws/internal/service/medialive" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -350,6 +351,10 @@ func (p *fwprovider) DataSources(ctx context.Context) []func() datasource.DataSo func (p *fwprovider) Resources(ctx context.Context) []func() resource.Resource { var resources []func() resource.Resource + resources = append(resources, func() resource.Resource { + return medialive.NewResourceMultiplexProgram(ctx) + }) + for _, sp := range p.Primary.Meta().(*conns.AWSClient).ServicePackages { for _, v := range sp.FrameworkResources(ctx) { v, err := v(ctx) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 77d68652a35..2144d0ad230 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -2187,7 +2187,7 @@ func New(_ context.Context) (*schema.Provider, error) { // ServicePackageData is used before configuration to determine the provider's exported resources and data sources. ServicePackages: []intf.ServicePackageData{ globalaccelerator.ServicePackageData, - medialive.ServicePackageData, + //medialive.ServicePackageData, meta.ServicePackageData, simpledb.ServicePackageData, sts.ServicePackageData, diff --git a/internal/service/medialive/medialive_test.go b/internal/service/medialive/medialive_test.go index 6fa53ddb86e..1e5db1ab7b6 100644 --- a/internal/service/medialive/medialive_test.go +++ b/internal/service/medialive/medialive_test.go @@ -15,6 +15,7 @@ func TestAccMediaLive_serial(t *testing.T) { }, "MultiplexProgram": { "basic": testAccMultiplexProgram_basic, + "update": testAccMultiplexProgram_update, "disappears": testAccMultiplexProgram_disappears, }, } diff --git a/internal/service/medialive/multiplex_program.go b/internal/service/medialive/multiplex_program.go index 940de5d2959..00f11c4bce9 100644 --- a/internal/service/medialive/multiplex_program.go +++ b/internal/service/medialive/multiplex_program.go @@ -32,6 +32,10 @@ func newResourceMultiplexProgram(_ context.Context) (intf.ResourceWithConfigureA return &multiplexProgram{}, nil } +func NewResourceMultiplexProgram(_ context.Context) resource.Resource { + return &multiplexProgram{} +} + const ( ResNameMultiplexProgram = "Multiplex Program" ) @@ -74,9 +78,6 @@ func (m *multiplexProgram) GetSchema(context.Context) (tfsdk.Schema, diag.Diagno NestingMode: tfsdk.BlockNestingModeList, MinItems: 1, MaxItems: 1, - PlanModifiers: tfsdk.AttributePlanModifiers{ - resource.RequiresReplace(), - }, Attributes: map[string]tfsdk.Attribute{ "program_number": { Type: types.Int64Type, @@ -113,10 +114,44 @@ func (m *multiplexProgram) GetSchema(context.Context) (tfsdk.Schema, diag.Diagno Type: types.Int64Type, Optional: true, Computed: true, + PlanModifiers: []tfsdk.AttributePlanModifier{ + resource.UseStateForUnknown(), + }, }, }, Blocks: map[string]tfsdk.Block{ "statemux_settings": { + DeprecationMessage: "Configure statmux_settings instead of statemux_settings. This block will be removed in the next major version of the provider.", + NestingMode: tfsdk.BlockNestingModeList, + MaxItems: 1, + Attributes: map[string]tfsdk.Attribute{ + "minimum_bitrate": { + Type: types.Int64Type, + Optional: true, + Computed: true, + PlanModifiers: []tfsdk.AttributePlanModifier{ + resource.UseStateForUnknown(), + }, + }, + "maximum_bitrate": { + Type: types.Int64Type, + Optional: true, + Computed: true, + PlanModifiers: []tfsdk.AttributePlanModifier{ + resource.UseStateForUnknown(), + }, + }, + "priority": { + Type: types.Int64Type, + Optional: true, + Computed: true, + PlanModifiers: []tfsdk.AttributePlanModifier{ + resource.UseStateForUnknown(), + }, + }, + }, + }, + "statmux_settings": { NestingMode: tfsdk.BlockNestingModeList, MaxItems: 1, Attributes: map[string]tfsdk.Attribute{ @@ -124,16 +159,25 @@ func (m *multiplexProgram) GetSchema(context.Context) (tfsdk.Schema, diag.Diagno Type: types.Int64Type, Optional: true, Computed: true, + PlanModifiers: []tfsdk.AttributePlanModifier{ + resource.UseStateForUnknown(), + }, }, "maximum_bitrate": { Type: types.Int64Type, Optional: true, Computed: true, + PlanModifiers: []tfsdk.AttributePlanModifier{ + resource.UseStateForUnknown(), + }, }, "priority": { Type: types.Int64Type, Optional: true, Computed: true, + PlanModifiers: []tfsdk.AttributePlanModifier{ + resource.UseStateForUnknown(), + }, }, }, }, @@ -178,7 +222,7 @@ func (m *multiplexProgram) Create(ctx context.Context, req resource.CreateReques return } - mpSettings, err := expandMultiplexProgramSettings(ctx, mps) + mpSettings, isStateMuxSet, err := expandMultiplexProgramSettings(ctx, mps) resp.Diagnostics.Append(err...) if resp.Diagnostics.HasError() { @@ -202,7 +246,7 @@ func (m *multiplexProgram) Create(ctx context.Context, req resource.CreateReques result.ID = types.String{Value: fmt.Sprintf("%s/%s", programName, multiplexId)} result.ProgramName = types.String{Value: aws.ToString(out.MultiplexProgram.ProgramName)} result.MultiplexID = types.String{Value: plan.MultiplexID.Value} - result.MultiplexProgramSettings = flattenMultiplexProgramSettings(out.MultiplexProgram.MultiplexProgramSettings) + result.MultiplexProgramSettings = flattenMultiplexProgramSettings(out.MultiplexProgram.MultiplexProgramSettings, isStateMuxSet) resp.Diagnostics.Append(resp.State.Set(ctx, result)...) @@ -231,7 +275,7 @@ func (m *multiplexProgram) Read(ctx context.Context, req resource.ReadRequest, r return } - out, err := FindMultipleProgramByID(ctx, conn, multiplexId, programName) + out, err := FindMultiplexProgramByID(ctx, conn, multiplexId, programName) if tfresource.NotFound(err) { diag.NewWarningDiagnostic( @@ -251,7 +295,22 @@ func (m *multiplexProgram) Read(ctx context.Context, req resource.ReadRequest, r return } - state.MultiplexProgramSettings = flattenMultiplexProgramSettings(out.MultiplexProgramSettings) + sm := make([]videoSettings, 1) + attErr := req.State.GetAttribute(ctx, path.Root("multiplex_program_settings"). + AtListIndex(0).AtName("video_settings"), &sm) + + resp.Diagnostics.Append(attErr...) + if resp.Diagnostics.HasError() { + return + } + + var stateMuxIsNull bool + if len(sm) > 0 { + if len(sm[0].StatemuxSettings.Elems) == 0 { + stateMuxIsNull = true + } + } + state.MultiplexProgramSettings = flattenMultiplexProgramSettings(out.MultiplexProgramSettings, stateMuxIsNull) state.ProgramName = types.String{Value: aws.ToString(out.ProgramName)} resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) @@ -262,15 +321,68 @@ func (m *multiplexProgram) Read(ctx context.Context, req resource.ReadRequest, r } func (m *multiplexProgram) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var model resourceMultiplexProgramData + conn := m.meta.MediaLiveConn + + var plan resourceMultiplexProgramData + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + programName, multiplexId, err := ParseMultiplexProgramID(plan.ID.Value) + + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.MediaLive, create.ErrActionReading, ResNameMultiplexProgram, plan.ProgramName.String(), nil), + err.Error(), + ) + return + } + + mps := make([]multiplexProgramSettings, 1) + resp.Diagnostics.Append(plan.MultiplexProgramSettings.ElementsAs(ctx, &mps, false)...) + if resp.Diagnostics.HasError() { + return + } - resp.Diagnostics.Append(req.Plan.Get(ctx, &model)...) + mpSettings, stateMuxIsNull, errExpand := expandMultiplexProgramSettings(ctx, mps) + resp.Diagnostics.Append(errExpand...) if resp.Diagnostics.HasError() { return } - resp.Diagnostics.Append(resp.State.Set(ctx, &model)...) + in := &medialive.UpdateMultiplexProgramInput{ + MultiplexId: aws.String(multiplexId), + ProgramName: aws.String(programName), + MultiplexProgramSettings: mpSettings, + } + + _, errUpdate := conn.UpdateMultiplexProgram(ctx, in) + + if errUpdate != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.MediaLive, create.ErrActionUpdating, ResNameMultiplexProgram, plan.ProgramName.String(), nil), + errUpdate.Error(), + ) + return + } + + //Need to find multiplex program because output from update does not provide state data + out, errUpdate := FindMultiplexProgramByID(ctx, conn, multiplexId, programName) + + if errUpdate != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.MediaLive, create.ErrActionUpdating, ResNameMultiplexProgram, plan.ProgramName.String(), nil), + errUpdate.Error(), + ) + return + } + + plan.MultiplexProgramSettings = flattenMultiplexProgramSettings(out.MultiplexProgramSettings, stateMuxIsNull) + + resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) } func (m *multiplexProgram) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { @@ -313,7 +425,42 @@ func (m *multiplexProgram) ImportState(ctx context.Context, req resource.ImportS resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } -func FindMultipleProgramByID(ctx context.Context, conn *medialive.Client, multiplexId, programName string) (*medialive.DescribeMultiplexProgramOutput, error) { +func (m *multiplexProgram) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) { + var data resourceMultiplexProgramData + + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + mps := make([]multiplexProgramSettings, 1) + resp.Diagnostics.Append(data.MultiplexProgramSettings.ElementsAs(ctx, &mps, false)...) + if resp.Diagnostics.HasError() { + return + } + + if len(mps[0].VideoSettings.Elems) > 0 || !mps[0].VideoSettings.IsNull() { + vs := make([]videoSettings, 1) + resp.Diagnostics.Append(mps[0].VideoSettings.ElementsAs(ctx, &vs, false)...) + if resp.Diagnostics.HasError() { + return + } + + statMuxSet := len(vs[0].StatmuxSettings.Elems) > 0 + stateMuxSet := len(vs[0].StatemuxSettings.Elems) > 0 + + if statMuxSet && stateMuxSet { + resp.Diagnostics.AddAttributeError( + path.Root("multiplex_program_settings").AtListIndex(0).AtName("video_settings").AtListIndex(0).AtName("statmux_settings"), + "Conflicting Attribute Configuration", + "Attribute statmux_settings cannot be configured with statemux_settings.", + ) + } + } +} + +func FindMultiplexProgramByID(ctx context.Context, conn *medialive.Client, multiplexId, programName string) (*medialive.DescribeMultiplexProgramOutput, error) { in := &medialive.DescribeMultiplexProgramInput{ MultiplexId: aws.String(multiplexId), ProgramName: aws.String(programName), @@ -338,11 +485,12 @@ func FindMultipleProgramByID(ctx context.Context, conn *medialive.Client, multip return out, nil } -func expandMultiplexProgramSettings(ctx context.Context, mps []multiplexProgramSettings) (*mltypes.MultiplexProgramSettings, diag.Diagnostics) { +func expandMultiplexProgramSettings(ctx context.Context, mps []multiplexProgramSettings) (*mltypes.MultiplexProgramSettings, bool, diag.Diagnostics) { if len(mps) == 0 { - return nil, nil + return nil, false, nil } + var stateMuxIsNull bool data := mps[0] l := &mltypes.MultiplexProgramSettings{ @@ -354,7 +502,7 @@ func expandMultiplexProgramSettings(ctx context.Context, mps []multiplexProgramS sd := make([]serviceDescriptor, 1) err := data.ServiceDescriptor.ElementsAs(ctx, &sd, false) if err.HasError() { - return nil, err + return nil, false, err } l.ServiceDescriptor = &mltypes.MultiplexProgramServiceDescriptor{ @@ -367,18 +515,34 @@ func expandMultiplexProgramSettings(ctx context.Context, mps []multiplexProgramS vs := make([]videoSettings, 1) err := data.VideoSettings.ElementsAs(ctx, &vs, false) if err.HasError() { - return nil, err + return nil, false, err } l.VideoSettings = &mltypes.MultiplexVideoSettings{ ConstantBitrate: int32(vs[0].ConstantBitrate.Value), } + // Deprecated: will be removed in the next major version if len(vs[0].StatemuxSettings.Elems) > 0 && !vs[0].StatemuxSettings.IsNull() { - sms := make([]statemuxSettings, 1) + sms := make([]statmuxSettings, 1) err := vs[0].StatemuxSettings.ElementsAs(ctx, &sms, false) if err.HasError() { - return nil, err + return nil, false, err + } + + l.VideoSettings.StatmuxSettings = &mltypes.MultiplexStatmuxVideoSettings{ + MinimumBitrate: int32(sms[0].MinimumBitrate.Value), + MaximumBitrate: int32(sms[0].MaximumBitrate.Value), + Priority: int32(sms[0].Priority.Value), + } + } + + if len(vs[0].StatmuxSettings.Elems) > 0 && !vs[0].StatmuxSettings.IsNull() { + stateMuxIsNull = true + sms := make([]statmuxSettings, 1) + err := vs[0].StatmuxSettings.ElementsAs(ctx, &sms, false) + if err.HasError() { + return nil, false, err } l.VideoSettings.StatmuxSettings = &mltypes.MultiplexStatmuxVideoSettings{ @@ -389,11 +553,11 @@ func expandMultiplexProgramSettings(ctx context.Context, mps []multiplexProgramS } } - return l, nil + return l, stateMuxIsNull, nil } var ( - statemuxAttrs = map[string]attr.Type{ + statmuxAttrs = map[string]attr.Type{ "minimum_bitrate": types.Int64Type, "maximum_bitrate": types.Int64Type, "priority": types.Int64Type, @@ -401,7 +565,8 @@ var ( videoSettingsAttrs = map[string]attr.Type{ "constant_bitrate": types.Int64Type, - "statemux_settings": types.ListType{ElemType: types.ObjectType{AttrTypes: statemuxAttrs}}, + "statemux_settings": types.ListType{ElemType: types.ObjectType{AttrTypes: statmuxAttrs}}, + "statmux_settings": types.ListType{ElemType: types.ObjectType{AttrTypes: statmuxAttrs}}, } serviceDescriptorAttrs = map[string]attr.Type{ @@ -417,7 +582,7 @@ var ( } ) -func flattenMultiplexProgramSettings(mps *mltypes.MultiplexProgramSettings) types.List { +func flattenMultiplexProgramSettings(mps *mltypes.MultiplexProgramSettings, stateMuxIsNull bool) types.List { elemType := types.ObjectType{AttrTypes: multiplexProgramSettingsAttrs} vals := types.Object{AttrTypes: multiplexProgramSettingsAttrs} @@ -430,7 +595,7 @@ func flattenMultiplexProgramSettings(mps *mltypes.MultiplexProgramSettings) type attrs["program_number"] = types.Int64{Value: int64(mps.ProgramNumber)} attrs["preferred_channel_pipeline"] = types.String{Value: string(mps.PreferredChannelPipeline)} attrs["service_descriptor"] = flattenServiceDescriptor(mps.ServiceDescriptor) - attrs["video_settings"] = flattenVideoSettings(mps.VideoSettings) + attrs["video_settings"] = flattenVideoSettings(mps.VideoSettings, stateMuxIsNull) vals.Attrs = attrs @@ -461,10 +626,10 @@ func flattenServiceDescriptor(sd *mltypes.MultiplexProgramServiceDescriptor) typ } } -func flattenStateMuxSettings(mps *mltypes.MultiplexStatmuxVideoSettings) types.List { - elemType := types.ObjectType{AttrTypes: statemuxAttrs} +func flattenStatMuxSettings(mps *mltypes.MultiplexStatmuxVideoSettings) types.List { + elemType := types.ObjectType{AttrTypes: statmuxAttrs} - vals := types.Object{AttrTypes: statemuxAttrs} + vals := types.Object{AttrTypes: statmuxAttrs} if mps == nil { return types.List{ElemType: elemType, Elems: []attr.Value{}} @@ -483,7 +648,7 @@ func flattenStateMuxSettings(mps *mltypes.MultiplexStatmuxVideoSettings) types.L } } -func flattenVideoSettings(mps *mltypes.MultiplexVideoSettings) types.List { +func flattenVideoSettings(mps *mltypes.MultiplexVideoSettings, stateMuxIsNull bool) types.List { elemType := types.ObjectType{AttrTypes: videoSettingsAttrs} vals := types.Object{AttrTypes: videoSettingsAttrs} @@ -491,9 +656,22 @@ func flattenVideoSettings(mps *mltypes.MultiplexVideoSettings) types.List { if mps == nil { return types.List{ElemType: elemType, Elems: []attr.Value{}} + } + + attrs["constant_bitrate"] = types.Int64{Value: int64(mps.ConstantBitrate)} + + if stateMuxIsNull { + attrs["statmux_settings"] = flattenStatMuxSettings(mps.StatmuxSettings) + attrs["statemux_settings"] = types.List{ + Elems: []attr.Value{}, + ElemType: types.ObjectType{AttrTypes: statmuxAttrs}, + } } else { - attrs["constant_bitrate"] = types.Int64{Value: int64(mps.ConstantBitrate)} - attrs["statemux_settings"] = flattenStateMuxSettings(mps.StatmuxSettings) + attrs["statmux_settings"] = types.List{ + Elems: []attr.Value{}, + ElemType: types.ObjectType{AttrTypes: statmuxAttrs}, + } + attrs["statemux_settings"] = flattenStatMuxSettings(mps.StatmuxSettings) } vals.Attrs = attrs @@ -548,10 +726,11 @@ type serviceDescriptor struct { type videoSettings struct { ConstantBitrate types.Int64 `tfsdk:"constant_bitrate"` - StatemuxSettings types.List `tfsdk:"statemux_settings"` + StatemuxSettings types.List `tfsdk:"statemux_settings"` // Deprecated: will be removed in the next major version + StatmuxSettings types.List `tfsdk:"statmux_settings"` } -type statemuxSettings struct { +type statmuxSettings struct { MaximumBitrate types.Int64 `tfsdk:"maximum_bitrate"` MinimumBitrate types.Int64 `tfsdk:"minimum_bitrate"` Priority types.Int64 `tfsdk:"priority"` diff --git a/internal/service/medialive/multiplex_program_test.go b/internal/service/medialive/multiplex_program_test.go index bfcce6fffcc..86591a04357 100644 --- a/internal/service/medialive/multiplex_program_test.go +++ b/internal/service/medialive/multiplex_program_test.go @@ -103,6 +103,50 @@ func testAccMultiplexProgram_basic(t *testing.T) { }) } +func testAccMultiplexProgram_update(t *testing.T) { + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + var multiplexprogram medialive.DescribeMultiplexProgramOutput + rName := fmt.Sprintf("tf_acc_%s", sdkacctest.RandString(8)) + resourceName := "aws_medialive_multiplex_program.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(t) + acctest.PreCheckPartitionHasService(names.MediaLiveEndpointID, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.MediaLiveEndpointID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckMultiplexProgramDestroy, + Steps: []resource.TestStep{ + { + Config: testAccMultiplexProgramConfig_update(rName, 100000), + Check: resource.ComposeTestCheckFunc( + testAccCheckMultiplexProgramExists(resourceName, &multiplexprogram), + resource.TestCheckResourceAttr(resourceName, "program_name", rName), + resource.TestCheckResourceAttrSet(resourceName, "multiplex_id"), + resource.TestCheckResourceAttr(resourceName, "multiplex_program_settings.0.program_number", "1"), + resource.TestCheckResourceAttr(resourceName, "multiplex_program_settings.0.preferred_channel_pipeline", "CURRENTLY_ACTIVE"), + resource.TestCheckResourceAttr(resourceName, "multiplex_program_settings.0.video_settings.0.statmux_settings.0.minimum_bitrate", "100000"), + ), + }, + { + Config: testAccMultiplexProgramConfig_update(rName, 100001), + Check: resource.ComposeTestCheckFunc( + testAccCheckMultiplexProgramExists(resourceName, &multiplexprogram), + resource.TestCheckResourceAttr(resourceName, "program_name", rName), + resource.TestCheckResourceAttrSet(resourceName, "multiplex_id"), + resource.TestCheckResourceAttr(resourceName, "multiplex_program_settings.0.program_number", "1"), + resource.TestCheckResourceAttr(resourceName, "multiplex_program_settings.0.preferred_channel_pipeline", "CURRENTLY_ACTIVE"), + resource.TestCheckResourceAttr(resourceName, "multiplex_program_settings.0.video_settings.0.statmux_settings.0.minimum_bitrate", "100001"), + ), + }, + }, + }) +} + func testAccMultiplexProgram_disappears(t *testing.T) { if testing.Short() { t.Skip("skipping long-running test in short mode") @@ -144,7 +188,7 @@ func testAccCheckMultiplexProgramDestroy(s *terraform.State) error { attributes := rs.Primary.Attributes - _, err := tfmedialive.FindMultipleProgramByID(ctx, conn, attributes["multiplex_id"], attributes["program_name"]) + _, err := tfmedialive.FindMultiplexProgramByID(ctx, conn, attributes["multiplex_id"], attributes["program_name"]) if tfresource.NotFound(err) { continue @@ -177,7 +221,7 @@ func testAccCheckMultiplexProgramExists(name string, multiplexprogram *medialive conn := acctest.Provider.Meta().(*conns.AWSClient).MediaLiveConn ctx := context.Background() - resp, err := tfmedialive.FindMultipleProgramByID(ctx, conn, multiplexId, programName) + resp, err := tfmedialive.FindMultiplexProgramByID(ctx, conn, multiplexId, programName) if err != nil { return create.Error(names.MediaLive, create.ErrActionCheckingExistence, tfmedialive.ResNameMultiplexProgram, rs.Primary.ID, err) @@ -210,6 +254,7 @@ resource "aws_medialive_multiplex" "test" { } `, rName)) } + func testAccMultiplexProgramConfig_basic(rName string) string { return acctest.ConfigCompose( testAccMultiplexProgramBaseConfig(rName), @@ -229,3 +274,25 @@ resource "aws_medialive_multiplex_program" "test" { } `, rName)) } + +func testAccMultiplexProgramConfig_update(rName string, minBitrate int) string { + return acctest.ConfigCompose( + testAccMultiplexProgramBaseConfig(rName), + fmt.Sprintf(` +resource "aws_medialive_multiplex_program" "test" { + program_name = %[1]q + multiplex_id = aws_medialive_multiplex.test.id + + multiplex_program_settings { + program_number = 1 + preferred_channel_pipeline = "CURRENTLY_ACTIVE" + + video_settings { + statmux_settings { + minimum_bitrate = %[2]d + } + } + } +} +`, rName, minBitrate)) +} diff --git a/website/docs/r/medialive_multiplex_program.html.markdown b/website/docs/r/medialive_multiplex_program.html.markdown index b49c57da352..8938d709308 100644 --- a/website/docs/r/medialive_multiplex_program.html.markdown +++ b/website/docs/r/medialive_multiplex_program.html.markdown @@ -10,6 +10,8 @@ description: |- Terraform resource for managing an AWS MediaLive MultiplexProgram. +~> **Note** Attribute `statemux_settings` has been deprecated and will be removed in a future major release. Please use `statmux_settings` instead. + ## Example Usage ### Basic Usage @@ -77,7 +79,14 @@ The following arguments are optional: ### Video Settings `constant_bitrate` - (Optional) Constant bitrate value. -`statemux_settings` - (Optional) Statemux settings. See [Statemux Settings](#statemux-settings) for more details. +`statemux_settings` - (Optional, **Deprecated**) Statemux settings. See [Statmux Settings](#statemux-settings) for more details. Settings from this attribute will apply to `statmux_settings`. Conflicts with `statmux_settings`. +`statmux_settings` - (Optional) Statmux settings. See [Statmux Settings](#statmux-settings) for more details Conflicts with `statemux_settings`. + +### Statmux Settings + +* `minimum_bitrate` - (Optional) Minimum bitrate. +* `maximum_bitrate` - (Optional) Maximum bitrate. +* `priority` - (Optional) Priority value. ### Statemux Settings