(aws-logs,aws-elasticsearch): Unable to pass the dynamically fetched Elastic Search domain Arn when creating a Subscription Filter. #27346
Labels
@aws-cdk/aws-logs
Related to Amazon CloudWatch Logs
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
Describe the bug
I am creating a Elastic Search Domain and then for the log groups I am trying to create a subscription filter . Below is the sample code
const devDomain = new es.CfnDomain(this, 'devDomain', {
elasticsearchVersion: '7.10',
for (const log_groupname of log_groups) {
const logGroup = logs.LogGroup.fromLogGroupName(this, 'log_group', log_groupname)
new logs.CfnSubscriptionFilter(this, 'log_groupa', {
logGroupName: logGroup.logGroupName,
filterPattern: '',
destinationArn: devDomain.domainArn, even though it is type string and is expecting string
roleArn: '0000000000000000000000000:role/service-role/sample-role-arn'
})
}
I am getting the following error when I pass it as above for destinationArn props. Also the reason for using L1 construct is that i would not able to pass the open search as the destination for the props destination[1]
[1] https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.ILogSubscriptionDestination.html
===ERROR===
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2322)
logs.generated.d.ts(856, 14): The expected type comes from property 'destinationArn' which is declared here on type 'CfnSubscriptionFilterProps'
(property) CfnSubscriptionFilterProps.destinationArn: string
===ERROR===
Expected Behavior
We should be able to fetch the CfnDomain Arn and also not sure why am i getting Domain which is L2 as deprecated. I am using cdk version 2.99.0 (build 0aa1096)
Current Behavior
const devDomain = new es.CfnDomain(this, 'devDomain', {
elasticsearchVersion: '7.10',
for (const log_groupname of log_groups) {
const logGroup = logs.LogGroup.fromLogGroupName(this, 'log_group', log_groupname)
new logs.CfnSubscriptionFilter(this, 'log_groupa', {
logGroupName: logGroup.logGroupName,
filterPattern: '',
destinationArn: devDomain.domainArn, even though it is type string and is expecting string
roleArn: '0000000000000000000000000:role/service-role/sample-role-arn'
})
}
I am getting the following error when I pass it as above for destinationArn props. Also the reason for using L1 construct is that i would not able to pass the open search as the destination for the props destination[1]
[1] https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.ILogSubscriptionDestination.html
===ERROR===
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2322)
logs.generated.d.ts(856, 14): The expected type comes from property 'destinationArn' which is declared here on type 'CfnSubscriptionFilterProps'
(property) CfnSubscriptionFilterProps.destinationArn: string
===ERROR===
Reproduction Steps
const devDomain = new es.CfnDomain(this, 'devDomain', {
elasticsearchVersion: '7.10',
for (const log_groupname of log_groups) {
const logGroup = logs.LogGroup.fromLogGroupName(this, 'log_group', log_groupname)
new logs.CfnSubscriptionFilter(this, 'log_groupa', {
logGroupName: logGroup.logGroupName,
filterPattern: '',
destinationArn: devDomain.domainArn, even though it is type string and is expecting string
roleArn: '0000000000000000000000000:role/service-role/sample-role-arn'
})
}
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.99.0 (build 0aa1096)
Framework Version
No response
Node.js Version
v20.5.1
OS
MacOs
Language
Typescript
Language Version
Version 4.9.5
Other information
No response
The text was updated successfully, but these errors were encountered: