Describe the bug
The iot.CfnTopicRule construct now supports an action called LocationAction (link to CloudFormation docs).
The LocationAction entity has a property called Timestamp which according to the CloudFormation docs is supposed to be of type AWS::IoT::TopicRule Timestamp and have shape:
{
"Unit": String,
"Value": String
}
At present, in version 1.179.0 the property has incorrect type of Date, which causes the synth step to fail.
Expected Behavior
The resource should have the correct type and allow to deploy correctly.
Current Behavior
Error:
cdk-stack.ts(114,17): error TS2322: Type '{ value: string; unit: string; }' is not assignable to type 'Date | IResolvable'.
Object literal may only specify known properties, but 'value' does not exist in type 'Date | IResolvable'

Reproduction Steps
import * as cdk from "@aws-cdk/core";
import * as iot from "@aws-cdk/aws-iot";
import * as iam from "@aws-cdk/aws-iam";
export class cdkStack extends cdk.Stack {
constructor(
scope: cdk.Construct,
id: string,
props?: cdk.StackProps,
) {
super(scope, id, props);
const role = new iam.Role(this, "iot-tracker-role", {
assumedBy: new iam.ServicePrincipal("iot.amazonaws.com"),
description: "IAM Role that allows IoT Core to update a Tracker",
inlinePolicies: {
allowTracker: new iam.PolicyDocument({
statements: [
new iam.PolicyStatement({
resources: [
`arn:aws:geo:${cdk.Stack.of(this).region}:${
cdk.Stack.of(this).account
}:tracker/tracker_location_workshop`,
],
actions: ["geo:BatchUpdateDevicePosition"],
}),
],
}),
},
});
// Create an IoT Topic Rule that will send the location updates to Location Service
const topicRule = new iot.CfnTopicRule(this, "TopicRule", {
ruleName: "assetTrackingRule",
topicRulePayload: {
sql: `SELECT * FROM 'iot/trackedAssets'`,
awsIotSqlVersion: "2016-03-23",
actions: [
{
location: {
deviceId: "${deviceID}",
latitude: "${longitude}",
longitude: "${latitude}",
roleArn: role.roleArn,
timestamp: {
value: "${timestamp()}",
unit: "MILLISECONDS",
},
trackerName: "tracker_location_workshop",
},
}
],
},
});
}
}
Possible Solution
Change the type to the correct one.
Additional Information/Context
Adding this manual override to the resource allows to deploy correctly, proving that the resource is mistyped in CDK:
topicRule.addOverride("Properties.TopicRulePayload.Actions.0", {
Location: {
DeviceId: "${deviceID}",
Latitude: "${longitude}",
Longitude: "${latitude}",
RoleArn: role.roleArn,
Timestamp: {
Value: "${timestamp()}",
Unit: "MILLISECONDS",
},
TrackerName: "tracker_location_workshop-ok",
},
});
CDK CLI Version
2.41.0
Framework Version
No response
Node.js Version
16.15.0
OS
Linux / macOS
Language
Typescript
Language Version
No response
Other information
No response
Describe the bug
The
iot.CfnTopicRuleconstruct now supports an action calledLocationAction(link to CloudFormation docs).The
LocationActionentity has a property calledTimestampwhich according to the CloudFormation docs is supposed to be of typeAWS::IoT::TopicRule Timestampand have shape:{ "Unit": String, "Value": String }At present, in version
1.179.0the property has incorrect type ofDate, which causes the synth step to fail.Expected Behavior
The resource should have the correct type and allow to deploy correctly.
Current Behavior
Error:
Reproduction Steps
Possible Solution
Change the type to the correct one.
Additional Information/Context
Adding this manual override to the resource allows to deploy correctly, proving that the resource is mistyped in CDK:
CDK CLI Version
2.41.0
Framework Version
No response
Node.js Version
16.15.0
OS
Linux / macOS
Language
Typescript
Language Version
No response
Other information
No response