I need to do environment variable substitution from a value from a SSM secret (secrets section in manifest). But escaping doesn't work as the doco mentioned.
variables:
TEST1: "https://\\${DATABASE_SERVER}:5000/ReportServer?"
TEST2: https://\${DATABASE_SERVER}:5000/ReportServer?
secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
DATABASE_SERVER: /database/server
I am getting the following error:
✘ interpolate environment variables for fisherassist-api manifest: environment variable "DATABASE_SERVER" is not defined
Firstly, this feature was released in copilot CLI v1.33.0 and I was using a older version. Got support from a ever so helpful mate from copilot gitter community
Secondly, composing Run time variables from other variables is not possible with Copilot at the moment. A similar feature request is there for this.
There are 2 workarounds to achieve this.
Approach 1
Approach 2
This is a bit complicated workaround is possibly modifying the ENTRYPOINT
This way the DATABASE_SERVER environment variable can be passed at runtime, and entrypoint.sh will set TEST1 and TEST2 accordingly.