resource "aws_efs_file_system" "ghe_backup_data" {
  creation_token = "ghe-backups"
  encrypted      = true
  kms_key_id     = aws_kms_key.ghe_backup_data.arn

  ### KMS bits needed


  ### 0.12
  lifecycle_policy {
    transition_to_ia = "AFTER_60_DAYS"
  }

  tags = merge( var.standard_tags, var.tags, { Name = "GitHub Enterprise Backup Data" })
}

resource "aws_efs_mount_target" "ghe_backup_mount" {
  file_system_id  = aws_efs_file_system.ghe_backup_data.id
  subnet_id       = var.private_subnets[0]
  security_groups = [ aws_security_group.ghe_backup_server.id ]
}
