### Rationale This snippet is a sample showing how to implement CloudWatch Logs streaming to ElasticSearch using `terraform`. I wrote this `gist` because I didn't found a clear, end-to-end example on how to achieve this task. In particular, I understood the `resource "aws_lambda_permission" "cloudwatch_allow"` part by reading a couple of bug reports plus this [stackoverflow post](https://stackoverflow.com/questions/38407660/terraform-configuring-cloudwatch-log-subscription-delivery-to-lambda). The `js` file is actually the _Lambda_ function automatically created by _AWS_ when creating this pipeline through the web console. I only added a `endpoint` variable handling so it is configurable from `terraform`. ### Usage Create a `cwl2eslambda.zip` file containing `cwl2es.js` at the root level. Invoke `terraform plan` to check for basic errors, then `terraform apply`.