I have a simple Laravel installation that I am trying to set up to run through a AWS CodePipeline using ECS.
What have I done?
My Codepipeline is set up with a buildspec.yml
file, where I have specified that it should use a value from the Parameter Store, like
env:
parameter-store:
TEST_STRING: "TEST"
My TEST
variable does exist in the Parameter Store and I can get it using the cli.
What do I want to do?
I want my environment variable to be accessible to my Laravel installation, so I can use the Parameter Store to save passwords and usernames for e.g. databases and apis.
What actually happens?
When I try to access the environment variable through php, I'm not getting any value. If I var_dump
$_ENV, then I cannot see my TEST_STRING in the given array.
I'm quite sure that the environment variable only exists in the build process, but I cannot figure out how to "transfer" the environment variable from my build process to the deployed code.
Question
What am I missing to make the environment variables from the build process available to the deployed code?