Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fargate] [request]: Support environment files (EnvironmentFile) with Windows containers #2475

Open
rhbecker-uw opened this issue Nov 19, 2024 · 0 comments
Labels
Proposed Community submitted issue

Comments

@rhbecker-uw
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction 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
Support environment files for Windows containers on Fargate, as described in: Pass environment variables to an Amazon ECS container.

Which service(s) is this request for?
Fargate

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?

We want to use environment variables inside of Windows containers for non-sensitive configuration values.

Passing a reference to an S3-hosted .env file is more convenient than specifying an array of "inline" environment variable objects. This is particularly the case when using CFN, where we try to reuse a single template to create many stacks, and therefore need to "parameterize" aspects that vary among stacks. There is no straightforward means of parameterizing an array of key/value pairs, as is required by the Environment property. Frankly, the EnvironmentFile property has the same issue (it's an array of key/value pairs), but we can get away with parameterizing a reference to a single S3 location, given that single location can contain all needed environment variables (see the example snippet below).

Are you currently working around this issue?
We're not yet using environment variables with Windows containers. If we must do so, we'll likely have to create service-specific CFN templates, rather than reusing a common CFN template.

Additional context

Though there are 2 existing issues about this (#1626 and #1627), discrepancies remain in the documentation.

Here is a CFN snippet we're using with Linux containers on Fargate, where a reference to an S3-hosted .env file is "parameterized".

  EcsTaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      ContainerDefinitions:
        - Image: !Ref Image
          EnvironmentFiles: !If
            - IsEnvironmentFileSpecified
            -
              -
                Type: s3
                Value: !Ref EnvironmentFile
            - !Ref AWS::NoValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposed Community submitted issue
Projects
None yet
Development

No branches or pull requests

1 participant