The issue seems to be that media_package_output_settings are persisted as an empty json array and when the state is read, the provider cannot tell if the media_package_output_settings are set.
Excerpt of the Terraform state:
I'm lacking the knowledge if the above fix would be considered dirty or even plain wrong, but I'm willing to open a PR and implement the fix when this is clarified. :)
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Terraform Core Version
1.4.6
AWS Provider Version
4.67.0
Affected Resource(s)
resource
aws_medialive_channel
(encoder_settings[*].output_groups[*].outputs[*].output_settings[*].media_package_output_settings
property)Expected Behavior
No diffs should be detected by Terraform when the config is not changed in between applies.
Actual Behavior
When a MediaPackage output is configured for
aws_medialive_channel
, a perpetual diff is detected by terraform on every apply.terraform plan
output:Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Apply the above terraform config multiple times.
Debug Output
No response
Panic Output
No response
Important Factoids
The
media_package_output_settings
field is special since it can only be an empty block and setting the block tells the provider that a MediaPackage output is used with the channel. CloudFormation docs: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-medialive-channel-mediapackageoutputdestinationsettings.html API docs: https://docs.aws.amazon.com/medialive/latest/apireference/channels-channelid.html#channels-channelid-model-mediapackageoutputsettingsThe issue seems to be that
media_package_output_settings
are persisted as an empty json array and when the state is read, the provider cannot tell if themedia_package_output_settings
are set. Excerpt of the Terraform state:We have investigated the issue and a potential bug is that the anonymous function returns an empty interface in line 5069 even if
MediaPackageOutputSettings
are set. https://github.com/hashicorp/terraform-provider-aws/blob/5675259bb8a9c0c59c239dcb8e869ab4d49aea8d/internal/service/medialive/channel_encoder_settings_schema.go#L5056-L5087 As a quick fix we tried to return an empty map in the anonymous function which seems to resolve the bug at first glance.With the fix, the
media_package_output_settings
are serialized as an array that contains an empty object ([{}]
), which looks legit to me.I'm lacking the knowledge if the above fix would be considered dirty or even plain wrong, but I'm willing to open a PR and implement the fix when this is clarified. :)
References
No response
Would you like to implement a fix?
Yes