export function setupClusterLogging()

in cdk/lib/cluster-logging.ts [12:67]


export function setupClusterLogging(
  stack: Stack,
  cluster: Cluster
): void {
  new AwsCustomResource(stack, "ClusterLogsEnabler", {
    policy: AwsCustomResourcePolicy.fromSdkCalls({
      resources: [`${cluster.clusterArn}/update-config`],
    }),
    onCreate: {
      physicalResourceId: { id: `${cluster.clusterArn}/LogsEnabler` },
      service: "EKS",
      action: "updateClusterConfig",
      region: stack.region,
      parameters: {
        name: cluster.clusterName,
        logging: {
          clusterLogging: [
            {
              enabled: true,
              types: [
                "api",
                "audit",
                "authenticator",
                "controllerManager",
                "scheduler",
              ],
            },
          ],
        },
      },
    },
    onDelete: {
      physicalResourceId: { id: `${cluster.clusterArn}/LogsEnabler` },
      service: "EKS",
      action: "updateClusterConfig",
      region: stack.region,
      parameters: {
        name: cluster.clusterName,
        logging: {
          clusterLogging: [
            {
              enabled: false,
              types: [
                "api",
                "audit",
                "authenticator",
                "controllerManager",
                "scheduler",
              ],
            },
          ],
        },
      },
    },
  });
}