So, guys, the issue was caused by the absence of this tag in the Auto Scaling Group configuration:
resource "aws_autoscaling_group" "test" {
# ... other configuration, including potentially other tags ...
tag {
key = "AmazonECSManaged"
value = true
propagate_at_launch = true
}
}