Type of property DocumentMetadataConfigurations incorrect, causing validation errors
cogwirrel opened this issue · 4 comments
Hi,
I've been using CDK to define a kendra index, and am trying to define custom attributes in the document metadata.
new kendra.CfnIndex(this, 'MyIndex', {
edition: 'DEVELOPER_EDITION',
name: `${props.stage}-MyIndex`,
roleArn: kendraIndexRole.roleArn,
documentMetadataConfigurations: {
documentMetadataConfigurationList: [
{
name: 'myAttribute',
type: 'STRING_VALUE',
search: {
displayable: true,
searchable: false,
sortable: false,
facetable: false,
},
},
],
},
});
When I synth and deploy, I get an error:
5:35:40 PM | UPDATE_FAILED | AWS::Kendra::Index | KendraWebCrawlerIndex
Model validation failed (#/DocumentMetadataConfigurations: expected type: JSONArray, found: JSONObject)
However this doesn't match the cloudformation documentation, which states that DocumentMetadataConfigurations
is an object with a single property DocumentMetadataConfigurationsList
.
See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kendra-index.html#cfn-kendra-index-documentmetadataconfigurations and https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kendra-index-documentmetadataconfigurationlist.html
It's also the case with the generated cdk CfnIndex
construct.
I'm not super familiar with how cloudformation works, but I believe the problem is that the top level property DocumentMetadataConfigurations
is defined as:
"DocumentMetadataConfigurations": {
"description": "Document metadata configurations",
"$ref": "#/definitions/DocumentMetadataConfigurationList"
},
And the DocumentMetadataConfigurationList
is defined as an array rather than an object with a single DocumentMetadataConfigurationsList
property.
"DocumentMetadataConfigurationList": {
"type": "array",
"maxItems": 500,
"items": {
"$ref": "#/definitions/DocumentMetadataConfiguration"
}
},
Thanks,
Jack
Raised an issue for aws-cdk :)