-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_iot: Bug in Generated CloudFormation Template when Creating IoT Job Templates #32459
Comments
Reproducible using CDK version import * as cdk from 'aws-cdk-lib';
import * as iot from 'aws-cdk-lib/aws-iot';
import * as iam from 'aws-cdk-lib/aws-iam';
export class CdktestStackNew extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const presignedRole = new iam.Role(this, 'TestIotRole', {
assumedBy: new iam.ServicePrincipal('iot.amazonaws.com'),
description: 'IAM Role to create pre-signed S3 URL for job payload.',
});
new iot.CfnJobTemplate(this, 'TestIotJobTemplate', {
description: 'Test IoT job Template',
jobTemplateId: 'test-iot-job-template',
document: '',
presignedUrlConfig: {
roleArn: presignedRole.roleArn,
expiresInSec: 300
}
});
}
} synthesizes to below CloudFormation template: Resources:
TestIotRoleBD9EE0EE:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: iot.amazonaws.com
Version: "2012-10-17"
Description: IAM Role to create pre-signed S3 URL for job payload.
Metadata:
aws:cdk:path: CdktestStackNew/TestIotRole/Resource
TestIotJobTemplate:
Type: AWS::IoT::JobTemplate
Properties:
Description: Test IoT job Template
Document: ""
JobTemplateId: test-iot-job-template
PresignedUrlConfig:
roleArn:
Fn::GetAtt:
- TestIotRoleBD9EE0EE
- Arn
expiresInSec: 300
Metadata:
aws:cdk:path: CdktestStackNew/TestIotJobTemplate
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Analytics: v2:deflate64:H4sIAAAAAAAA/y3KsQ6CMBCA4Wdhb09oTHRnc6zsppQjOWh7hisyNH13Y3D6/uE30N0MtI07RPtp1YFGKM/s/KrcIa9CLkKxHFD1c/pZFXGGfk4PHgeM7+AyVmVReN/8ef27qsQTwiKXT3cH08K1WYRIb3vKFBHs6RcL0ovBggAAAA==
Metadata:
aws:cdk:path: CdktestStackNew/CDKMetadata/Default
Parameters:
BootstrapVersion:
Type: AWS::SSM::Parameter::Value<String>
Default: /cdk-bootstrap/hnb659fds/version
Description: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip] The PresignedUrlConfig > Few Findings:
@Adesanya-Toba Please defines properties |
Related issue #32258 (comment). Also refer #32285 for the reasoning behind it. |
Describe the bug
I tried adding IoT Job Templates to my CDK code but I get the following errors when using the code snippets from the doc.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
A new job template is created in IoT Core.
Current Behavior
I get the following error (The
*******
is me hiding confidential stuff):Reproduction Steps
Try out this code snippet in a
Construct
class!Possible Solution
Manually update this bit of the generated Cloudformation template, as the CF docs refer to
roleArn
asRoleArn
. Please note thatexpires_in_sec
has the same issue.Additional Information/Context
No response
CDK CLI Version
2.172.0 (build 0f666c5)
Framework Version
No response
Node.js Version
v20.14.0
OS
Ubuntu 22.04.5 LTS
Language
Python
Language Version
Python (3.10.12)
Other information
No response
The text was updated successfully, but these errors were encountered: