This configuration works as expected. The variables declared in both the test and sidecars sections get passed to the containers.
# You can override any of the values defined above by environment.
environments:
# Although not mentioned in documentation, configuring sidecar environment-specific variables is supported.
# ref: https://github.com/aws/copilot-cli/issues/3674#issuecomment-1157084196
test:
variables:
SOME_VARIABLE1: 'somevalue1'
SOME_VARIABLE2: 'somevalue2'
sidecars:
mysidecar1:
variables:
SOME_VARIABLE1: 'somevalue1'
SOME_VARIABLE2: 'somevalue2'
But it's rather redundant. Especially when I need to pass the same variables to all containers. I thought I could be more succinct by utilizing the env_file param like so
# You can override any of the values defined above by environment.
environments:
# Although not mentioned in documentation, configuring sidecar environment-specific variables is supported.
# ref: https://github.com/aws/copilot-cli/issues/3674#issuecomment-1157084196
test:
env_file: env/.test.env
sidecars:
mysidecar1:
env_file: env/.test.env
The main service container gets passed the environment variables just fine. Good. But the sidecars don't. So it looks like I have to resort to the former approach.
This configuration works as expected. The variables declared in both the
testandsidecarssections get passed to the containers.But it's rather redundant. Especially when I need to pass the same variables to all containers. I thought I could be more succinct by utilizing the
env_fileparam like soThe main service container gets passed the environment variables just fine. Good. But the sidecars don't. So it looks like I have to resort to the former approach.