Trying to create a signing profile for platform "AmazonFreeRTOS-Default" or "AWSIoTDeviceManagement-SHA256-ECDSA" fails with CDK L2 and L1 constructs.
Expected Behavior
A signing profile for platform "AmazonFreeRTOS-Default" or "AWSIoTDeviceManagement-SHA256-ECDSA" has been created.
Current Behavior
Creating a singing profile for a platform ID other than "AWSLambda-SHA384-ECDSA" fails with following message:
Properties validation failed for resource MySigningProfile with message:
/PlatformId: # only 1 subschema matches out of 2
/PlatformId: failed validation constraint for keyword [enum]
Reproduction Steps
import * as signer from 'aws-cdk-lib/aws-signer';
// neither of the provided snippets work. Not L2 and also not L1
const signingProfile = new signer.SigningProfile(this, 'SigningProfile', {
platform: signer.Platform.AMAZON_FREE_RTOS_DEFAULT,
});
const cfnSigningProfile = new signer.CfnSigningProfile(this, 'MyCfnSigningProfile', {
platformId: 'AmazonFreeRTOS-Default',
});
Possible Solution
Unfortunately it seems there is no solution until CloudFormation supports all signing platforms. Still, I believe this issue is valuable as I spent days to figure out why cdk deploy fails before realizing that the issue is not on my side.
While trying to dig into the issue, I've also tried to create a signing profile through the AWS CLI, providing the same parameters that CDK sets in the CloudFormation template. There the error message is a lot clearer
> aws signer put-signing-profile --profile-name test --platform-id AWSIoTDeviceManagement-SHA256-ECDSA
An error occurred (ValidationException) when calling the PutSigningProfile operation: signing material cannot be null.
It became clear to me that CloudFormation and thereby also CDK don't provide a way to set the signing material. The signing material refers to the AWS Certificate Manager certificate used for signing. In my use case, I would have to additionally set the signing parameters which is also not supported through CloudFormation.
CDK CLI Version
2.73.0
Framework Version
No response
Node.js Version
18.12.1
OS
macOS Ventura 13.3.1
Language
Typescript
Language Version
No response
Other information
The only way that I could find to create a signing profile with CDK was to resort to AWSCustomResources
Describe the bug
Trying to create a signing profile for platform "AmazonFreeRTOS-Default" or "AWSIoTDeviceManagement-SHA256-ECDSA" fails with CDK L2 and L1 constructs.
Expected Behavior
A signing profile for platform "AmazonFreeRTOS-Default" or "AWSIoTDeviceManagement-SHA256-ECDSA" has been created.
Current Behavior
Creating a singing profile for a platform ID other than "AWSLambda-SHA384-ECDSA" fails with following message:
Reproduction Steps
import * as signer from 'aws-cdk-lib/aws-signer';
// neither of the provided snippets work. Not L2 and also not L1 const signingProfile = new signer.SigningProfile(this, 'SigningProfile', { platform: signer.Platform.AMAZON_FREE_RTOS_DEFAULT, });
const cfnSigningProfile = new signer.CfnSigningProfile(this, 'MyCfnSigningProfile', { platformId: 'AmazonFreeRTOS-Default', });
Possible Solution
Unfortunately it seems there is no solution until CloudFormation supports all signing platforms. Still, I believe this issue is valuable as I spent days to figure out why
cdk deploy
fails before realizing that the issue is not on my side.reference: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/1641
Additional Information/Context
While trying to dig into the issue, I've also tried to create a signing profile through the AWS CLI, providing the same parameters that CDK sets in the CloudFormation template. There the error message is a lot clearer
It became clear to me that CloudFormation and thereby also CDK don't provide a way to set the signing material. The signing material refers to the AWS Certificate Manager certificate used for signing. In my use case, I would have to additionally set the signing parameters which is also not supported through CloudFormation.
CDK CLI Version
2.73.0
Framework Version
No response
Node.js Version
18.12.1
OS
macOS Ventura 13.3.1
Language
Typescript
Language Version
No response
Other information
The only way that I could find to create a signing profile with CDK was to resort to
AWSCustomResources