CfnRule is not generating targets in YAML
CfnRule is not generating targets in YAML
Repro: this code:
var rule = new evt.CfnRule(this, "cloudwatchevent", new evt.CfnRuleProps { State = "ENABLED", EventPattern = ep, Targets = lambda.FunctionArn });
is generating this (no Targets):
cloudwatchevent: Type: AWS::Events::Rule Properties: EventPattern: source: - aws.ec2 detail-type: - AWS API Call via CloudTrail detail: eventSource: - ec2.amazonaws.com eventName: - CreateSecurityGroup - DeleteTags State: ENABLED Metadata: aws:cdk:path: DeploymentStack/cloudwatchevent
Expected: Targets declared in AWS::Events::Rule
Environment
- CLI Version : 1.58.0
- Framework Version: .NET Core 3.1
- OS: Windows
This is :bug: Bug Report
Missed the point that no CfnRule was needed from my side - Rule was enough. Then with AddTargets() worked as expected.