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

fix(ecs): secretToken required but declared as optional #21745

Merged
merged 5 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,13 +868,15 @@ taskDefinition.addContainer('TheContainer', {
### splunk Log Driver

```ts
declare const secret: secretsmanager.Secret;

// Create a Task Definition for the container to start
const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef');
taskDefinition.addContainer('TheContainer', {
image: ecs.ContainerImage.fromRegistry('example-image'),
memoryLimitMiB: 256,
logging: ecs.LogDrivers.splunk({
token: SecretValue.secretsManager('my-splunk-token'),
secretToken: secret,
url: 'my-splunk-url',
}),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ export interface SplunkLogDriverProps extends BaseLogDriverProps {
*
* The splunk-token is added to the SecretOptions property of the Log Driver Configuration. So the secret value will not be
* resolved or viewable as plain text.
*
* Please provide at least one of `token` or `secretToken`.
* @default - If secret token is not provided, then the value provided in `token` will be used.
*/
readonly secretToken?: Secret;
readonly secretToken: Secret;

/**
* Path to your Splunk Enterprise, self-service Splunk Cloud instance, or Splunk
Expand Down
12 changes: 0 additions & 12 deletions packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,4 @@ describe('splunk log driver', () => {
],
});
});

test('throws when neither token nor secret token are provided', () => {
expect(() => {
td.addContainer('Container', {
image,
logging: ecs.LogDrivers.splunk({
url: 'my-splunk-url',
}),
memoryLimitMiB: 128,
});
}).toThrow('Please provide either token or secretToken.');
});
});