- Newest
- Most votes
- Most comments
I solved it by adding outputPaths: ["certificateArn", "certificatePem", "keyPair.PublicKey", "keyPair.PrivateKey"] to the function.
Thank you!
You are not passing the certificate Id but its so-called "physical id" (See CFN doc):
Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must have length less than or equal to 64
Ok, but just cloned the repository of the tutorial. There the function is described as follows:
const iotCreateKeysAndCertificateCr = new cr.AwsCustomResource(this, 'CreateKeysAndCertificate', {
policy: cr.AwsCustomResourcePolicy.fromStatements([
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
actions: ['iot:CreateKeysAndCertificate', 'iot:UpdateCertificate'],
}),
]),
logRetention: logs.RetentionDays.ONE_DAY,
onCreate: {
service: 'Iot',
action: 'createKeysAndCertificate',
parameters: {
setAsActive: true,
},
physicalResourceId: cr.PhysicalResourceId.fromResponse('certificateId'),
},
onDelete: {
service: 'Iot',
action: 'updateCertificate',
parameters: {
certificateId: new cr.PhysicalResourceIdReference(),
newStatus: 'INACTIVE',
},
},
});
Which id is incorrect and needs to be replaced? Thanks
The missing piece of code is your CFN template: that may be where the issue lies.
