data "aws_eks_cluster" "amp-prod-da" {
  name = "amp-prod-da"
}

data "aws_eks_cluster_auth" "amp-prod-da" {
  name = "amp-prod-da"
}

resource "aws_eks_cluster" "amp-prod-da" {
  #checkov:skip=CKV_AWS_58: Ensure EKS Cluster has Secrets Encryption Enabled. Migrated existing cluster as-is.
  name                      = "amp-prod-da"
  version                   = var.eks_version
  role_arn                  = var.eks_cluster_role_arn
  enabled_cluster_log_types = var.enabled_cluster_log_types
  encryption_config {
    resources = var.encryption_config_resources
    provider {
      key_arn = var.encryption_config_provider_key_arn
    }
  }
  vpc_config {
    endpoint_private_access = var.vpc_config_endpoint_private_access
    endpoint_public_access  = var.vpc_config_endpoint_public_access
    security_group_ids = [
      aws_security_group.AMP-DIGARCH-P-EKS-Cluster-SG.id
    ]
    subnet_ids = [aws_subnet.AMP-DIGARCH-P-XAPP-1A.id, aws_subnet.AMP-DIGARCH-P-XAPP-1B.id]
  }
  tags = merge(var.tags, { Name = "amp-prod-da" })
}