terraform-provider-awscc
terraform-provider-awscc copied to clipboard
Update issue on MediaPackageV2 Origin Endpoint
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- 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
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
- The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.
Terraform CLI and Terraform AWS Cloud Control Provider Version
Terraform v1.8.0 awscc v0.72.1
Affected Resource(s)
- awscc_mediapackagev2_origin_endpoint
- (TBC on other resources)
Terraform Configuration Files
resource "awscc_mediapackagev2_origin_endpoint" "example_channel_group" {
channel_group_name = "my-example-group"
channel_name = "my-example-channel"
container_type = "TS"
origin_endpoint_name = "my-example-llhls-endpoint"
low_latency_hls_manifests = [
{
manifest_name = "index"
manifest_window_seconds = 30
program_date_time_interval_seconds = 30
filter_configuration = {
start = "2024-02-20T10:25:00+00:00"
end = "2024-02-23T10:26:00+00:00"
time_delay_seconds = 600
manifest_filter = "video_codec:h264;video_height:720-1080"
}
}
]
tags = [
{
key = "environment"
value = "dev"
}
]
}
Expected Behavior
I'm testing this resource and encountering an issue when trying to remove values that have already been deployed and part of the tf state file.
Actual Behavior
When I run terraform apply the first time - the resource successfully provisions.
When I try and update the resource i.e. remove values entirely in filter_configuration
the provider tells me that there are "No changes".
Steps to Reproduce
- Deploy the resource pasted above (awscc_mediapackagev2_origin_endpoint)
- [needs further testing following just an example]: Change filter configuration by commenting out some or all of
start
,end
,time_delay_seconds
ormanifest_filter
- terraform plan these changes and you'll get a "No changes" message back
Looking at this resource in particular there are a lot of mentions of "UseStateForUnknown()" on the PlanModifiers that might be causing why it's falling back to the state file - but wasn't sure how/why this was set: https://github.com/hashicorp/terraform-provider-awscc/blob/main/internal/aws/mediapackagev2/origin_endpoint_resource_gen.go#L302
- #0000
I am unable to replicate this problem on provider ver: 0.76.0, Terraform ver: 1.8.2
Terraform will perform the following actions:
# awscc_mediapackagev2_origin_endpoint.example_channel_group will be updated in-place
~ resource "awscc_mediapackagev2_origin_endpoint" "example_channel_group" {
+ description = (known after apply)
+ hls_manifests = (known after apply)
id = "arn:aws:mediapackagev2:us-east-1:204034886740:channelGroup/my-example-group/channel/my-example-channel/originEndpoint/my-example-llhls-endpoint"
~ low_latency_hls_manifests = [
~ {
+ child_manifest_name = (known after apply)
~ filter_configuration = {
~ time_delay_seconds = 600 -> 700
# (3 unchanged attributes hidden)
}
+ scte_hls = (known after apply)
# (4 unchanged attributes hidden)
},
]
tags = [
{
key = "environment"
value = "dev"
},
]
# (9 unchanged attributes hidden)
}
I will close this issue now, feel free to open it again if you are able to replicate it on the latest provider.
hey - i just retested on 0.76.0 - but i can still replicate it. Just to be clear, I was commenting out/removing one of the values in the filter_configuration
.
I did test this in the AWS CLI (on cloudcontrol) - and if I remove the configuration (by using patch-document), the service does remove it automatically so issue is localised to awscc I believe.
AWS CLI cloudcontrol test details:
Have a resource with start
& end
defined on the filter_configuration then run CLI with:
--patch-document "[{\"op\":\"replace\",\"path\":\"/LowLatencyHlsManifests\",\"value\":[{\"ManifestWindowSeconds\":30,\"ManifestName\":\"index\",\"ProgramDateTimeIntervalSeconds\":30,\"FilterConfiguration\":{\"TimeDelaySeconds\":600,\"ManifestFilter\":\"video_codec:h264;video_height:720-1080\"}}]}]"
And it removes it from the resource!
thanks, I miss understood the original problem, I apologize.
In this case, you excluded certain attribute from the HCL configuration after the initial terraform apply
.
AWSCC provider will then use the last known value in the Terraform statefile and compared it with CCAPI GetResource, which will resulted in no-diff detected.
Related to #191 and #119
@wellsiau-aws Yes, this problem is due to having to mark filter_configuration
as Optional+Computed -- removing an attribute means that the attribute's value is Unknown, not Null and so no change to remove the property is sent to the Cloud Control API.
Setting the attributes to nil
explicitly should clear them.