amazon-ecs-render-task-definition icon indicating copy to clipboard operation
amazon-ecs-render-task-definition copied to clipboard

Unable to use multi-line environment variables

Open bachya opened this issue 1 year ago • 3 comments

We have an ECS task into which we've inserted a private key as a multi-line environment variable from a secret store. To retain the newlines, we wrap the environment variable in quotes inside of this actions:

environment-variables: |
  PRIVATE_KEY="{{ secrets.PRIVATE_KEY }}"

Because of how the action parses environment variables (by newlines), it will fail to see this multi-line value as a single variable:

Error: Cannot parse the environment variable '***'. Environment variable pairs must be of the form NAME=value.

Is there a way this scenario can be accommodated?

bachya avatar Mar 27 '23 02:03 bachya

@bachya pretty sure your issue is that GH Actions is masking secrets.PRIVATE_KEY automatically.

dougireton avatar Dec 12 '23 19:12 dougireton

@bachya Did you find a way how to fix it?

VladPetriv avatar Apr 19 '24 06:04 VladPetriv

@bachya Did you find a way how to fix it?

I ended up storing my key as a base64-encoded string; then, in my application code, I decode it before I want to use it.

bachya avatar Apr 19 '24 15:04 bachya