-
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
aws-batch-alpha: Unable to specify ECS container env vars containing secrets #25559
Labels
@aws-cdk/aws-batch
Related to AWS Batch
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p1
Comments
Malanius
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
May 12, 2023
Yeah I noticed the type is |
pahud
added
p1
effort/medium
Medium work item – several days of effort
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
May 12, 2023
Our hotifx for this issue was: const job = new batchAlpha.EcsJobDefinition(..., {container: {secrets: Object.values(secretsMap)}} /* Define as usual */)
const cfnContainerDef = job.node.defaultChild as CfnJobDefinition;
const secrets: { Name: string; ValueFrom: string }[] = [];
Object.entries(secretsMap).forEach(([Name, secret]) => {
secrets.push({ Name, ValueFrom: secret.secretArn });
});
cfnContainerDef.addPropertyOverride('ContainerProperties.Secrets', secrets); |
mergify bot
pushed a commit
that referenced
this issue
Jun 29, 2023
…ironment Variables & Enable Kubernetes Secret Volumes (#26126) Changes the type of `secrets` from `ISecret[]` to `{ [key: string]: ISecret }`. The `key` is the name of the environment variable to expose to the container. Also enables the specification of EKS Kubernetes volumes, which our README documented but wasn't actually supported because of a CFN issue that has since been fixed. Closes #25559. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
lukey-aleios
pushed a commit
to lukey-aleios/aws-cdk
that referenced
this issue
Jun 30, 2023
…ironment Variables & Enable Kubernetes Secret Volumes (aws#26126) Changes the type of `secrets` from `ISecret[]` to `{ [key: string]: ISecret }`. The `key` is the name of the environment variable to expose to the container. Also enables the specification of EKS Kubernetes volumes, which our README documented but wasn't actually supported because of a CFN issue that has since been fixed. Closes aws#25559. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
lukey-aleios
pushed a commit
to lukey-aleios/aws-cdk
that referenced
this issue
Jun 30, 2023
…ironment Variables & Enable Kubernetes Secret Volumes (aws#26126) Changes the type of `secrets` from `ISecret[]` to `{ [key: string]: ISecret }`. The `key` is the name of the environment variable to expose to the container. Also enables the specification of EKS Kubernetes volumes, which our README documented but wasn't actually supported because of a CFN issue that has since been fixed. Closes aws#25559. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
@aws-cdk/aws-batch
Related to AWS Batch
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p1
Describe the bug
Since the changes in the batch-alpha module in 2.74.0, it is impossible to define environment variables holding values from secrets. This is due to the changed interface between the old
JobDefinitionContainer
and newIEcsContainerDefinition
.The old interface correctly uses
key: value from ECS secret
with control of which env variable the secret is assigned to and also which secret field is used. The new one just expects an array of Secrets Manager secrets that don't provide any way to specify these things.Expected Behavior
To be able to define and use ECS secrets in the same way as with previous constructs.
Current Behavior
The new one just expects an array of Secrets Manager secrets that don't provide any way to assign the secret value and field to the container env variable.
I didn't even try to synthesise and deploy this to see what would happen as this clearly doesn't do what's needed.
Reproduction Steps
This is working pre 2.74.0:
Trying to update to the new, post 2.74.0 constructs, the secrets property is incompatible:
The new interface also requires some properties that were optional and had default values in the old one like CPU and memory resources.
Possible Solution
Using the correct interface for secrets property in order to be able to use ECS secrets as before and be able to upgrade existing job definitions is probably the way.
Additional Information/Context
No response
CDK CLI Version
2.79.1
Framework Version
Node.js Version
16.20.0
OS
Linux
Language
Typescript
Language Version
Typescript (4.9.5)
Other information
No response
The text was updated successfully, but these errors were encountered: