/**

SAGEMAKER NOTEBOOK - LIFECYCLE CONFIGURATION 

This allows for an automatic shutdown of notebooks - see on-start.sh for more details.

**/

# Create AWS Sagemaker notebook instance lifecycle configuration
resource "aws_sagemaker_notebook_instance_lifecycle_configuration" "notebook_config" {
  count    = var.lifecycle_config_enabled ? 1 : 0
  name     = "${var.environment}-${var.service_name}-lifecycle-config"
  on_start = filebase64(var.lifecyle_script_path)
}
