-
We are using LambdaFunction as an event target on an event rule for which we set a condtion. It looks like the auto generated lambda permission doesn't "inherit" the condition from the rule. This results in the following cloudformation error during deployment:
It can be reproduces with the following code: const myRule = new Rule(this, 'MyRule', {
ruleName: 'MyRule',
schedule: Schedule.cron({
minute: '00',
hour: '22',
day: '*',
month: '*',
year: '*',
}),
targets: [
new LambdaFunction(
myLambdaFunctionAliasArn,
{
retryAttempts: 3,
maxEventAge: Duration.hours(2),
}
),
],
});
(myRule.node.defaultChild as CfnRule).cfnOptions.condition = new CfnCondition(this, 'MyCondition', ....); Is there anyway to workaround this issue or should a report a bug? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To answer my own question for anyone who lands here: A workaround is to use aspects as suggested here. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
To answer my own question for anyone who lands here: A workaround is to use aspects as suggested here.