Skip to content

Commit

Permalink
fix(aws-ecs): broken splunk-logging tag-option in fargate platform …
Browse files Browse the repository at this point in the history
…version 1.4 (aws#13882)

Set `splunk-tag` when `tag` is set. This will keep the API constant, however it will add an additional `splunk-tag` in the key-value `Options` property in `AWS::ECS::TaskDefinition`s - `LogConfiguration`.

This is a very pragmatic approach. Feel free to suggest something else.

closes aws#13881 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
bweigel committed Mar 30, 2021
1 parent 8571008 commit e9d9299
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class SplunkLogDriver extends LogDriver {
'splunk-verify-connection': this.props.verifyConnection,
'splunk-gzip': this.props.gzip,
'splunk-gzip-level': this.props.gzipLevel,
'splunk-tag': this.props.tag,
...renderCommonLogDriverOptions(this.props),
}),
};
Expand Down
31 changes: 31 additions & 0 deletions packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,35 @@ nodeunitShim({

test.done();
},

'create a splunk log driver using splunk-tag property when tag is defined'(test: Test) {
// WHEN
td.addContainer('Container', {
image,
logging: ecs.LogDrivers.splunk({
token: cdk.SecretValue.secretsManager('my-splunk-token'),
url: 'my-splunk-url',
tag: 'abc',
}),
memoryLimitMiB: 128,
});

// THEN
expect(stack).to(haveResourceLike('AWS::ECS::TaskDefinition', {
ContainerDefinitions: [
{
LogConfiguration: {
LogDriver: 'splunk',
Options: {
'splunk-token': '{{resolve:secretsmanager:my-splunk-token:SecretString:::}}',
'splunk-url': 'my-splunk-url',
'splunk-tag': 'abc',
},
},
},
],
}));

test.done();
},
});

0 comments on commit e9d9299

Please sign in to comment.