resource "aws_instance" "digsysd3-ocm01" {
  #checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  #checkov:skip=CKV_AWS_8: Ensure all data stored in the Launch configuration or instance Elastic Blocks Store is securely encrypted
  #checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  #checkov:skip=CKV_AWS_135: Ensure that EC2 is EBS optimized
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "t3.medium"
  iam_instance_profile        = "digsysd-digsysd-ocm01"
  vpc_security_group_ids      = [aws_security_group.DIGSYS-D3-OCM-SG.id]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.DIGSYS-D3-IAPP-1A.id
  associate_public_ip_address = "false"
  key_name                    = "digsys-dev-18MARCH2024"
  tags = merge(
    var.ec2_tags,
    var.cloudops_firewall_protected_tag,
    {
      Name           = "digsysd3-ocm01",
      Environment    = "Dev",
      SERVER_TYPE    = "EC2",
      OS             = "AL3",
      "Patch Group"  = "General"
      CLOPS_APPROVED = "YES",
      ME-Joined      = "NO"
    }
  )
}

resource "aws_instance" "digsysd3-dra2app01" {
  #checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  #checkov:skip=CKV_AWS_8: Ensure all data stored in the Launch configuration or instance Elastic Blocks Store is securely encrypted
  #checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  #checkov:skip=CKV_AWS_135: Ensure that EC2 is EBS optimized
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "t3.medium"
  iam_instance_profile        = "digsysd-digsysd-dra2app01"
  vpc_security_group_ids      = [aws_security_group.DIGSYS-D3-DRA2APP01-SG.id]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.DIGSYS-D3-XAPP-1A.id
  associate_public_ip_address = "false"
  key_name                    = "digsys-dev-18MARCH2024"
  tags = merge(
    var.ec2_tags,
    var.cloudops_firewall_protected_tag,
    {
      Name           = "digsysd3-dra2app01",
      Environment    = "Dev",
      SERVER_TYPE    = "EC2",
      OS             = "AL3",
      "Patch Group"  = "General"
      CLOPS_APPROVED = "YES"
      ME-Joined      = "NO"
    }
  )
}

resource "aws_instance" "digsysd3-eai2app01" {
  #checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  #checkov:skip=CKV_AWS_8: Ensure all data stored in the Launch configuration or instance Elastic Blocks Store is securely encrypted
  #checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  #checkov:skip=CKV_AWS_135: Ensure that EC2 is EBS optimized
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "t3.medium"
  iam_instance_profile        = "digsysd-digsysd-eai2app01"
  vpc_security_group_ids      = [aws_security_group.DIGSYS-D3-EAI2APP01-SG.id, aws_security_group.DIGSYS-D3-INTERNAL-SG.id]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.DIGSYS-D3-IAPP-1A.id
  associate_public_ip_address = "false"
  key_name                    = "digsys-dev-18MARCH2024"
  tags = merge(
    var.ec2_tags,
    var.cloudops_firewall_protected_tag,
    {
      Name           = "digsysd3-eai2app01",
      Environment    = "Dev",
      SERVER_TYPE    = "EC2",
      OS             = "AL3",
      "Patch Group"  = "General"
      CLOPS_APPROVED = "YES"
      ME-Joined      = "NO"
    }
  )
}
/*
resource "aws_instance" "digsysd3-eom1app01" {
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "t3.medium"
  iam_instance_profile        = "digsysd-digsysd-eom1app01"
  vpc_security_group_ids      = [aws_security_group.DIGSYS-D3-EOM1APP01-SG.id]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.DIGSYS-D3-XAPP-1B.id
  associate_public_ip_address = "false"
  key_name                    = "digsys-dev-18MARCH2024"
  tags = merge(
    var.ec2_tags,
    var.cloudops_firewall_protected_tag,
    {
      Name           = "digsysd3-eom1app01",
      Environment    = "Dev",
      SERVER_TYPE    = "EC2",
      OS             = "AL3",
      "Patch Group"  = "General"
      CLOPS_APPROVED = "YES"
      ME-Joined      = "NO"
    }
  )
}
*/

resource "aws_instance" "digsysd3-akhq01" {
  #checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  #checkov:skip=CKV_AWS_8: Ensure all data stored in the Launch configuration or instance Elastic Blocks Store is securely encrypted
  #checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  #checkov:skip=CKV_AWS_135: Ensure that EC2 is EBS optimized
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "t3.medium"
  iam_instance_profile        = "digsysd-digsysd-akhq01"
  vpc_security_group_ids      = [aws_security_group.DIGSYS-D3-AKHQ01-SG.id]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.DIGSYS-D3-XAPP-1B.id
  associate_public_ip_address = "false"
  key_name                    = "digsys-dev-18MARCH2024"
  tags = merge(
    var.ec2_tags,
    var.cloudops_firewall_protected_tag,
    {
      Name           = "digsysd3-akhq01",
      Environment    = "Dev",
      SERVER_TYPE    = "EC2",
      OS             = "AL3",
      "Patch Group"  = "General"
      CLOPS_APPROVED = "YES"
      ME-Joined      = "NO"
    }
  )
}

resource "aws_instance" "digsysd3-tools01" {
  #checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  #checkov:skip=CKV_AWS_8: Ensure all data stored in the Launch configuration or instance Elastic Blocks Store is securely encrypted
  #checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  #checkov:skip=CKV_AWS_135: Ensure that EC2 is EBS optimized
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "t3.medium"
  iam_instance_profile        = "digsysd-digsysd-tools01"
  vpc_security_group_ids      = [aws_security_group.DIGSYS-D3-TOOLS-SG.id]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.DIGSYS-D3-XAPP-1A.id
  associate_public_ip_address = "false"
  key_name                    = "digsys-dev-18MARCH2024"
  tags = merge(
    var.ec2_tags,
    var.cloudops_firewall_protected_tag,
    {
      Name           = "digsysd3-tools01",
      Environment    = "Dev",
      SERVER_TYPE    = "EC2",
      OS             = "AL3",
      "Patch Group"  = "General"
      CLOPS_APPROVED = "YES"
      ME-Joined      = "NO"
    }
  )
}

resource "aws_instance" "i-01e3ff6603aabbb64" {
  #checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                                  = "ami-0f796f3df49f1aa72"
  associate_public_ip_address          = false
  availability_zone                    = "eu-central-1b"
  disable_api_stop                     = false
  disable_api_termination              = false
  ebs_optimized                        = true
  get_password_data                    = false
  hibernation                          = false
  iam_instance_profile                 = "digsysd-digsysd-ocm01"
  instance_initiated_shutdown_behavior = "stop"
  instance_type                        = "t3.medium"
  key_name                             = "eom-dev-ff"
  monitoring                           = false
  placement_partition_number           = 0
  private_ip                           = "10.11.188.95"
  secondary_private_ips                = []
  security_groups                      = []
  source_dest_check                    = true
  subnet_id                            = "subnet-024ff3eeb07c92a41"
  tags = merge(
    var.ec2_tags,
    var.cloudops_firewall_protected_tag,
    {
      Name           = "digsysd3-ocm02",
      Environment    = "Dev",
      SERVER_TYPE    = "EC2",
      OS             = "AL3",
      "Patch Group"  = "General"
      CLOPS_APPROVED = "YES"
      ME-Joined      = "NO"
    }
  )
  tenancy                = "default"
  vpc_security_group_ids = ["sg-07f958d6d3d56b808"]
  capacity_reservation_specification {
    capacity_reservation_preference = "open"
  }
  cpu_options {
    core_count       = 1
    threads_per_core = 2
  }
  credit_specification {
    cpu_credits = "unlimited"
  }
  ebs_block_device {
    delete_on_termination = false
    device_name           = "/dev/sdf"
    encrypted             = true
    iops                  = 3000
    kms_key_id            = "arn:aws:kms:eu-central-1:718729873097:key/3166f2a4-6bae-4e20-992c-529a38c0ea46"
    snapshot_id           = "snap-0bb44121197d5ac31"
    tags                  = {}
    throughput            = 125
    volume_size           = 40
    volume_type           = "gp3"
  }
  ebs_block_device {
    delete_on_termination = false
    device_name           = "/dev/sdg"
    encrypted             = true
    iops                  = 3000
    kms_key_id            = "arn:aws:kms:eu-central-1:718729873097:key/3166f2a4-6bae-4e20-992c-529a38c0ea46"
    snapshot_id           = "snap-02efa574dd0dd9bdc"
    tags                  = {}
    throughput            = 125
    volume_size           = 5
    volume_type           = "gp3"
  }
  ebs_block_device {
    delete_on_termination = true
    device_name           = "/dev/sdb"
    encrypted             = true
    iops                  = 3000
    kms_key_id            = "arn:aws:kms:eu-central-1:718729873097:key/3166f2a4-6bae-4e20-992c-529a38c0ea46"
    snapshot_id           = "snap-0c4fbf16e6144f491"
    tags                  = {}
    throughput            = 125
    volume_size           = 5
    volume_type           = "gp3"
  }
  ebs_block_device {
    delete_on_termination = true
    device_name           = "/dev/sdc"
    encrypted             = true
    iops                  = 3000
    kms_key_id            = "arn:aws:kms:eu-central-1:718729873097:key/3166f2a4-6bae-4e20-992c-529a38c0ea46"
    snapshot_id           = "snap-080fe7b9156dd94eb"
    tags                  = {}
    throughput            = 125
    volume_size           = 5
    volume_type           = "gp3"
  }
  ebs_block_device {
    delete_on_termination = true
    device_name           = "/dev/sdd"
    encrypted             = true
    iops                  = 3000
    kms_key_id            = "arn:aws:kms:eu-central-1:718729873097:key/3166f2a4-6bae-4e20-992c-529a38c0ea46"
    snapshot_id           = "snap-050cc725f6672f62c"
    tags                  = {}
    throughput            = 125
    volume_size           = 5
    volume_type           = "gp3"
  }
  ebs_block_device {
    delete_on_termination = true
    device_name           = "/dev/sde"
    encrypted             = true
    iops                  = 3000
    kms_key_id            = "arn:aws:kms:eu-central-1:718729873097:key/3166f2a4-6bae-4e20-992c-529a38c0ea46"
    snapshot_id           = "snap-03b59d7167e0bd5f2"
    tags                  = {}
    throughput            = 125
    volume_size           = 10
    volume_type           = "gp3"
  }
  enclave_options {
    enabled = false
  }
  maintenance_options {
    auto_recovery = "default"
  }
  metadata_options {
    http_endpoint               = "enabled"
    http_put_response_hop_limit = 2
    http_tokens                 = "required"
    instance_metadata_tags      = "disabled"
  }
  private_dns_name_options {
    enable_resource_name_dns_a_record    = false
    enable_resource_name_dns_aaaa_record = false
    hostname_type                        = "ip-name"
  }
  root_block_device {
    delete_on_termination = true
    encrypted             = true
    iops                  = 3000
    kms_key_id            = "arn:aws:kms:eu-central-1:718729873097:key/3166f2a4-6bae-4e20-992c-529a38c0ea46"
    tags                  = {}
    throughput            = 125
    volume_size           = 8
    volume_type           = "gp3"
  }
}
