Attaching Distribution to CloudFront Realtime Log Config

I don’t see a way to attach a distribution cache behaviors to a real-time log config in the Terraform docs.

Is there a supported way to do this?

Every time I perform a terraform apply, the attached distribution to my real-time log config gets removed.

Did you found any way to do this?

Hi!
I encountered the same issue, and I hope this helps you. The solution is to add this line in the “behavior” section of CloudFront:
realtime_log_config_arn = aws_cloudfront_realtime_log_config.YOUR.XXXXXXX.arn
Example:
ordered_cache_behavior {
path_pattern = “/test.jpg”
allowed_methods = [“GET”, “HEAD”, “OPTIONS”]
cached_methods = [“GET”, “HEAD”]
target_origin_id = aws_s3_bucket.my_app_cache_s3.id
cache_policy_id = “658327ea-f89d-4fab-a63d-7e88639e58f6” ##ID Managed-CachingOptimized
compress = true
viewer_protocol_policy = “redirect-to-https”
realtime_log_config_arn = aws_cloudfront_realtime_log_config.config_cloudfront_logs_my_app.arn

}

Regards