Environment Variables can be Tricky

Shivan infront of words "env" and dollar sign
Environment variables

Special characters may not act in the way you intend in the context of environment variables.

Here is an example of gotcha we had to experience.

The situation involved generating random passwords with special characters like $. Terraform has a service that does this.

The random passwords were stored in a .env file.

Here is a video showing a play around with this project.

Here is the link to the project on GitHub.

The remedy was to use Terraform’s ability to generate override special character and to exclude the special characters that caused the problems like $.

I hope you found this useful. Happy for any feedback if necessary. Thanks for reading.