Logstash not reading the environment variable properly

As we are connecting to a secure elasticsearch via logstash, I have decided to have the password of the elasticsearch configured as a env variable for example ${ELASTIC_SEARCH_PASSWORD}

but it doesnt work as expected when the env variable has a special character.

For Dev/SIT space has a simple password lets say elasticisamazing whereas for PROD it is not a simple, here is a sample password elastic@amazing@123 the moment i have @ symbol it seems the environment variable is not behaving correctly..

For now, we have hardcoded the password in the conf file, and it works fine but going forward would like to have this coming from the env variable.

When configuring via env, it throws error such as "you are connecting to a dead elasticsearch node"