aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.57k stars 3.87k forks source link

location: eventBridgeEnabled not working with CfnTracker #29276

Open solegaonkar opened 7 months ago

solegaonkar commented 7 months ago

Describe the bug

The EventBridgeEnabled property in the Location Tracker is not present in the CfnTrackerProps. Even if I add it forcefully with an @ts-ignore, it does not reflect in the generated CloudFormation stack.

After struggling hard, I had to set it manually. Can you please fix this?

Expected Behavior

CfnTrackerProps should have a property eventBridgeEnabled, and it should map to the EventBridgeEnabled in the Location Tracker resource of the CloudFormation template

Current Behavior

The field is missing in the data type, and not mapped to the CloudFormation stack

Reproduction Steps

const cfnTracker = new location.CfnTracker(this, "MyCfnTracker", { trackerName: "AssetTracker", description: "description", positionFiltering: "AccuracyBased", eventBridgeEnabled: true, });

Possible Solution

The CfnTrackerProps Type should be updated to include this field, and it should be appropriately mapped to the generated CloudFormation template

Additional Information/Context

No response

CDK CLI Version

2.130.0

Framework Version

No response

Node.js Version

18.16.0

OS

Windows

Language

TypeScript

Language Version

No response

Other information

No response

pahud commented 7 months ago

Yes it does exist in the CFN document and CFN spec 162.0.0.

And it does exist in 2.130.0 api reference.

I didn't see any error from my IDE

image

The field is missing in the data type, and not mapped to the CloudFormation stack

What made you believe it was missing in the data type and not mapped?

solegaonkar commented 7 months ago

That is strange! This is what I see..

image

The location was imported as...

import { aws_location as location } from "aws-cdk-lib";

When I tried Ctrl+Click on the CfnTracker, then CfnTrackerProps to see its code, this is what I see

export interface CfnTrackerProps {
    /**
     * An optional description for the tracker resource.
     *
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-tracker.html#cfn-location-tracker-description
     */
    readonly description?: string;
    /**
     * A key identifier for an [AWS KMS customer managed key](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html) . Enter a key ID, key ARN, alias name, or alias ARN.
     *
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-tracker.html#cfn-location-tracker-kmskeyid
     */
    readonly kmsKeyId?: string;
    /**
     * Specifies the position filtering for the tracker resource.
     *
     * Valid values:
     *
     * - `TimeBased` - Location updates are evaluated against linked geofence collections, but not every location update is stored. If your update frequency is more often than 30 seconds, only one update per 30 seconds is stored for each unique device ID.
     * - `DistanceBased` - If the device has moved less than 30 m (98.4 ft), location updates are ignored. Location updates within this area are neither evaluated against linked geofence collections, nor stored. This helps control costs by reducing the number of geofence evaluations and historical device positions to paginate through. Distance-based filtering can also reduce the effects of GPS noise when displaying device trajectories on a map.
     * - `AccuracyBased` - If the device has moved less than the measured accuracy, location updates are ignored. For example, if two consecutive updates from a device have a horizontal accuracy of 5 m and 10 m, the second update is ignored if the device has moved less than 15 m. Ignored location updates are neither evaluated against linked geofence collections, nor stored. This can reduce the effects of GPS noise when displaying device trajectories on a map, and can help control your costs by reducing the number of geofence evaluations.
     *
     * This field is optional. If not specified, the default value is `TimeBased` .
     *
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-tracker.html#cfn-location-tracker-positionfiltering
     */
    readonly positionFiltering?: string;
    /**
     * @deprecated this property has been deprecated
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-tracker.html#cfn-location-tracker-pricingplan
     */
    readonly pricingPlan?: string;
    /**
     * @deprecated this property has been deprecated
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-tracker.html#cfn-location-tracker-pricingplandatasource
     */
    readonly pricingPlanDataSource?: string;
    /**
     * The name for the tracker resource.
     *
     * Requirements:
     *
     * - Contain only alphanumeric characters (A-Z, a-z, 0-9) , hyphens (-), periods (.), and underscores (_).
     * - Must be a unique tracker resource name.
     * - No spaces allowed. For example, `ExampleTracker` .
     *
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-tracker.html#cfn-location-tracker-trackername
     */
    readonly trackerName: string;
}

There is no eventBridgeEnabled in there.

Here is the record in my package.json

    "@aws-sdk/client-location": "^3.521.0",

Am I using the wrong version? Or any error in the configuration? Can you please help me debug?