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

(aws-ecs): addSecret() for a ContainerDefinition #18959

Closed
1 of 2 tasks
danwiltshire opened this issue Feb 13, 2022 · 1 comment · Fixed by #21826
Closed
1 of 2 tasks

(aws-ecs): addSecret() for a ContainerDefinition #18959

danwiltshire opened this issue Feb 13, 2022 · 1 comment · Fixed by #21826
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p1

Comments

@danwiltshire
Copy link
Contributor

Description

Similar to addEnvironment() I'd like to add an addSecret() method.

Use Case

I'm using Aspects to configure third-party services on ECS services. For example, setting environment variables and secrets for a logging solution.

Today I'm using an escape hatch to add additional Secrets.

Proposed Solution

const container = taskDefinition.addContainer('nginx', {
  image: ecs.ContainerImage.fromRegistry('nginx'),
});

container.addSecret('SECRET_1', ecs.Secret.fromSecretsManager(secret));
container.addSecret('SECRET_2', ecs.Secret.fromSecretsManager(secretField, 'password'));

Other information

Have written code for this and I will link soon.

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@danwiltshire danwiltshire added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 13, 2022
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Feb 13, 2022
@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 15, 2022
@madeline-k madeline-k removed their assignment Feb 24, 2022
@NGL321 NGL321 added the in-progress This issue is being actively worked on. label May 17, 2022
FlorinAsavoaie added a commit to FlorinAsavoaie/aws-cdk that referenced this issue Aug 30, 2022
FlorinAsavoaie added a commit to FlorinAsavoaie/aws-cdk that referenced this issue Aug 30, 2022
FlorinAsavoaie added a commit to FlorinAsavoaie/aws-cdk that referenced this issue Aug 30, 2022
FlorinAsavoaie added a commit to FlorinAsavoaie/aws-cdk that referenced this issue Aug 31, 2022
FlorinAsavoaie added a commit to FlorinAsavoaie/aws-cdk that referenced this issue Sep 1, 2022
FlorinAsavoaie added a commit to FlorinAsavoaie/aws-cdk that referenced this issue Sep 1, 2022
FlorinAsavoaie added a commit to FlorinAsavoaie/aws-cdk that referenced this issue Sep 1, 2022
@mergify mergify bot closed this as completed in #21826 Sep 2, 2022
mergify bot pushed a commit that referenced this issue Sep 2, 2022
…tiating them (#21826)

### Description

Similar to `addEnvironment()`, an `addSecret()` method is useful to add secrets to ECS Containers after instantiating them via the constructor.

### Use Case

The most important use-case is when writing Task Definition Extensions or Aspects to augment ECS services. For example, setting environment variables and secrets for a logging or monitoring solution.

Right now, this can be done only using Escape Hatches and there is no higher level functionality to obtain this behaviour.

### Proposed Solution

```typescript
const container = taskDefinition.addContainer('nginx', {
  image: ecs.ContainerImage.fromRegistry('nginx'),
});

container.addSecret('SECRET_1', ecs.Secret.fromSecretsManager(secret));
container.addSecret('SECRET_2', ecs.Secret.fromSecretsManager(secretField, 'password'));
```

closes #18959

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-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*
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p1
Projects
None yet
4 participants