Skip to content

Commit 26ac81f

Browse files
fix(ecs): secretToken required but declared as optional (#21745)
`token` is no longer a valid option in v2, so `secretToken` is required by virtue of needing to provide at least one of `token` or `secretToken` Removed test which checks for error because `secretToken` is now required so we cannot check for error, even with `testDeprecated` to my knowledge fixes #21744 ---- ### All Submissions: * [ ] 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 * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] 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*
1 parent d48690e commit 26ac81f

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

packages/@aws-cdk/aws-ecs/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -868,13 +868,15 @@ taskDefinition.addContainer('TheContainer', {
868868
### splunk Log Driver
869869

870870
```ts
871+
declare const secret: secretsmanager.Secret;
872+
871873
// Create a Task Definition for the container to start
872874
const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef');
873875
taskDefinition.addContainer('TheContainer', {
874876
image: ecs.ContainerImage.fromRegistry('example-image'),
875877
memoryLimitMiB: 256,
876878
logging: ecs.LogDrivers.splunk({
877-
token: SecretValue.secretsManager('my-splunk-token'),
879+
secretToken: secret,
878880
url: 'my-splunk-url',
879881
}),
880882
});

packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ export interface SplunkLogDriverProps extends BaseLogDriverProps {
3737
*
3838
* The splunk-token is added to the SecretOptions property of the Log Driver Configuration. So the secret value will not be
3939
* resolved or viewable as plain text.
40-
*
41-
* Please provide at least one of `token` or `secretToken`.
42-
* @default - If secret token is not provided, then the value provided in `token` will be used.
4340
*/
44-
readonly secretToken?: Secret;
41+
readonly secretToken: Secret;
4542

4643
/**
4744
* Path to your Splunk Enterprise, self-service Splunk Cloud instance, or Splunk

packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts

-12
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,4 @@ describe('splunk log driver', () => {
209209
],
210210
});
211211
});
212-
213-
test('throws when neither token nor secret token are provided', () => {
214-
expect(() => {
215-
td.addContainer('Container', {
216-
image,
217-
logging: ecs.LogDrivers.splunk({
218-
url: 'my-splunk-url',
219-
}),
220-
memoryLimitMiB: 128,
221-
});
222-
}).toThrow('Please provide either token or secretToken.');
223-
});
224212
});

0 commit comments

Comments
 (0)