diff --git a/lib/aws-genai-llm-chatbot-stack.ts b/lib/aws-genai-llm-chatbot-stack.ts index 9c5e566c6..ad0f679b4 100644 --- a/lib/aws-genai-llm-chatbot-stack.ts +++ b/lib/aws-genai-llm-chatbot-stack.ts @@ -384,19 +384,21 @@ export class AwsGenAILLMChatbotStack extends cdk.Stack { }, ] ); - NagSuppressions.addResourceSuppressionsByPath( - this, - [ - `/${this.stackName}/RagEngines/KendraRetrieval/KendraRole/DefaultPolicy/Resource`, - ], - [ - { - id: "AwsSolutions-IAM5", - reason: - "Access to all log groups required for CloudWatch log group creation.", - }, - ] - ); + if (props.config.rag.engines.kendra.createIndex) { + NagSuppressions.addResourceSuppressionsByPath( + this, + [ + `/${this.stackName}/RagEngines/KendraRetrieval/KendraRole/DefaultPolicy/Resource`, + ], + [ + { + id: "AwsSolutions-IAM5", + reason: + "Access to all log groups required for CloudWatch log group creation.", + }, + ] + ); + } } } // Implicitly created resources with changing paths