diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts index d7e66c7c79961..dfafd02d4c291 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts @@ -286,11 +286,11 @@ function parseProps(props: any): aws.EKS.CreateClusterRequest { parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + if (typeof (parsed.logging?.clusterLogging[0]?.enabled) === 'string') { parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; } - if (typeof (parsed.logging?.clusterLogging[1].enabled) === 'string') { + if (typeof (parsed.logging?.clusterLogging[1]?.enabled) === 'string') { parsed.logging.clusterLogging[1].enabled = parsed.logging.clusterLogging[1].enabled === 'false'; }