-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
(ECS): Missing support for environment files for Fargate deployments #18226
Comments
Thanks for opening this feature request, @sergekukharev. This would be a great feature to have. I am labelling this as p2 for now, which means that the CDK team will not be able to work on it right now. But, we always welcome contributions! Take a look at the contributing guide to get started. |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
keep |
I confirmed that currently we can add environmentFiles for FargateTaskDefinition. I verified with the following code. (CDK version 2.94.0) const bucket = s3.Bucket.fromBucketName(this, 'Bucket', myBucketName);
const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef');
taskDefinition.addContainer('amazonlinux', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
environmentFiles: [
ecs.EnvironmentFile.fromBucket(bucket, 'assets/demo-env-file.env')
],
});
TaskDef54694570:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- EnvironmentFiles:
- Type: s3
Value:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :s3:::<My Bucket Name>/assets/demo-env-file.env
Essential: true
Image: public.ecr.aws/amazonlinux/amazonlinux:latest
Name: amazonlinux
Cpu: "256"
Family: Issue18226StackTaskDef8EAEF185
Memory: "512"
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
TaskRoleArn:
Fn::GetAtt:
- TaskDefTaskRole1EDB4A67
- Arn
Metadata:
aws:cdk:path: Issue18226Stack/TaskDef/Resource It seems that this restriction has been removed by #11820. So we just only need to remove the description |
…gate (#27081) Currently, CDK document includes the following description. https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html#environment-variables > Support for environment files is restricted to the EC2 launch type for files hosted on S3. However, this is out of date. Fargate has been [supported environment files](https://aws.amazon.com/jp/blogs/containers/latest-updates-to-aws-fargate-for-amazon-ecs/), and this restriction on CDK had been already removed by #11820. This PR removes the out of date description from document. Closes #18226 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…gate (#27081) Currently, CDK document includes the following description. https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html#environment-variables > Support for environment files is restricted to the EC2 launch type for files hosted on S3. However, this is out of date. Fargate has been [supported environment files](https://aws.amazon.com/jp/blogs/containers/latest-updates-to-aws-fargate-for-amazon-ecs/), and this restriction on CDK had been already removed by #11820. This PR removes the out of date description from document. Closes #18226 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Description
I'm trying to configure my Fargate service to use Environment Files. The official documentation says 1:
At the same time, Fargate supports Environment Files for a long time 23.
Is there any chance this feature will be added soon? Since it's supported by EC2 already, should be an easy win.
Use Case
I need this to manage my secrets and env variables in a more secure way. Any workaround ideas are appreciated.
Proposed Solution
Environment files are supported fully for Fargate deployments. Bonus points - it's possible to provide env files configuration in
ApplicationLoadBalancedTaskImageOptions
Other information
Unit tests are misleading for this configuration. The following test will pass, while
cdk synth
won't add the environment file to the template:Acknowledge
Footnotes
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html#environment-variables ↩
https://aws.amazon.com/blogs/containers/latest-updates-to-aws-fargate-for-amazon-ecs/ ↩
https://github.com/aws/containers-roadmap/issues/371 ↩
The text was updated successfully, but these errors were encountered: