aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

CfnRule is not generating targets in YAML

Open akirsman opened this issue 6 years ago • 1 comments

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

akirsman avatar Aug 13 '20 20:08 akirsman

Missed the point that no CfnRule was needed from my side - Rule was enough. Then with AddTargets() worked as expected.

akirsman avatar Aug 14 '20 01:08 akirsman