I have an aws instance running ELK server on it, with an EBS attached. All mamanged by Terraform.

Elasticsearch's path.data is pointed towards the mounted dir of EBS. Data is stored as /ebs_vol/nodes/0/indices . Works perfectly fine.

The Problem:

When I destroy and re-create the instance (with Terraform), the ELK server is all set BUT it overwrites the /ebs_vol/nodes/0/indices and all the data present in elasticsearch before destroy/create is gone now.

Expected:

After aws_instance destroy/create elasticsearch data should persist.

It would be great if someone can help!