[ECS] [request]: support environment variable file syntax as documented
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
According to the documentation of [environment variable files](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html#taskdef-envfiles-considerations) ECS is using the same syntax as [Docker Compose](https://docs.docker.com/compose/env-file/). However, in practice ECS uses a simpler syntax.
> Each line in an environment file must contain an environment variable in VARIABLE=VALUE format. Spaces or quotation marks are included as part of the values. Lines beginning with # are treated as comments and are ignored. **For more information about the environment variable file syntax, see [Declare default environment variables in file](https://docs.docker.com/compose/env-file/).**
This links to the [Docker Compose environment file syntax](https://docs.docker.com/compose/environment-variables/env-file/) which allows quoted values, inline comments, shell escape sequences, etc.
**Which service(s) is this request for?**
ECS
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
It is currently not possible to inject environment variables containing a newline. This makes it difficult to inject a PEM certificate, e.g.
```
CERTIFICATE="-----BEGIN CERTIFICATE-----\nMII...\n-----END CERTIFICATE-----\n"
```
**Are you currently working around this issue?**
We currently base64 encode/decode the value.
**Additional context**
This was initially raised as issue aws/amazon-ecs-agent#3429 and would be fixed by aws/amazon-ecs-agent#3763.
Contributor guide
Research direction
Start by comparing the ECS environment-file documentation with the linked Docker Compose env-file syntax, then read aws/amazon-ecs-agent#3429 and #3763 for the implementation context. Done means ECS accepts quoted values and escaped newlines such as the PEM certificate example according to the documented syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker-compose
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100