-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(aws-ecs): pass a secret to ContainerImage's buildArgs #14395
Comments
I have a similar need. I'd like to have some Docker Lambda functions (.NET 5) and also have a need to pull in private packages from an internal repository. I'd prefer to have the packages restored during the Docker build, but I cannot find a way to securely provide the token to the Docker build step. We're capable of achieving this by defining our own CodeBuild projects, retrieving the value from some secure location (e.g., SSM) and then providing that variable to Docker via In an attempt to provide an environment variable in a similar fashion but without the overhead of explicitly setting up a CodeBuild project, we tried to use a CDK Pipeline (pipelines/CodePipeline). This defines a CodeBuild project for us and nearly fits our needs. However, the build args are provided to Docker in quotes and so the reference is not expanded ( |
We have a similar use case - would be great to see this supported! 👍 The only workarounds currently seems to be to either:
Did anyone come across any other workarounds? @fitzchak @dillon-odonovan If any of the maintainers could give us a hint where to start with this, we may be able to contribute a pull request, potentially. Thanks! |
This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue. |
Just ran into a similar problem trying to use |
We also have a similar need where we need to use have secrets injected via buildArgs (specifically, Artifactory credentials). The suggestions here are viable and would work for us as well. One other thought - Could the buildArgs value be optional? Something like: readonly buildArgs?: {
[key: string]: string | undefined;
}; If the value is undefined, CDK could pass the build args to the docker build command without those values, and rely on the local environment (see https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg). This would allow folks to define and/or set those values on their continuous integration as environment variables, but not end up exposing/storing them in the cdk synth output. |
Our team also has a need for this - in our case we want to install some libraries from a private git repository as part of the docker build for deploying a containerised lambda function. Doing so requires authenticating to the git repo with a token. Seeing work on this feature would be great! |
Similar need here as well. We have a container requiring AWS credentials for CodeArtifact authentication. An NPM tool is needed inside the built container. |
Similar need here. Would ideally like a build arg passed which references an environment variable in the build environment to provide credentials for a private package repo to our docker build process. |
Partially closes #14910 and #14395 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@AjkayAlan We have the same need so I just created an issue to track it as this is different from the need of this issue |
Similar need, when i try to use docker image in lambda, I need to pass a token to dowload a private repository. I used a environment variable in cdk deploy, but the problem then is that if i go to CloudFormation i can see my credentials as a string in the template Metadata. |
+1 for this on the lambda |
Currently it is possible to pass only strings to ContainerImage's buildArgs.
Feature request: Add an option to pass a secret to
ContainerImage
. This parameter can be calledbuildArgsSecrets
orsecrets
as forQueueProcessingFargateService
.Use Case
I need to create a .ssh key on the machine at build time.
Proposed Solution
Dockerfile:
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: