resource "aws_instance" "aomad2-aomapgbouncer03" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "m5.large"
  iam_instance_profile        = "aomad-aomad2-asputil01"
  vpc_security_group_ids      = [aws_security_group.sg-02c7f689d0e644bad.id]
  disable_api_termination     = "true"
  subnet_id                   = "subnet-00e1abd0f0d804e4c"
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  tags = merge(
    var.common_tags,
    {
      "Name"           = "aomad2-aomapgbouncer03",
      "Environment"    = "Dev",
      "SERVER_TYPE"    = "EC2",
      "OS"             = "AL3",
      "Patch Group"    = "General",
      "Business-Unit"  = "SME-AOMA-Core",
      "Project-Code"   = "SME-2000-0306A"
      "Project-Name"   = "AOMA-Core"
      "CLOPS_APPROVED" = "YES",
      "ME-Joined"      = "NO",
      "OPS"            = "STND",
      "DATA"           = "NORMAL",
      "Owner"          = "nathaniel.lovett@sonymusic.com",
      "Terraform"      = "True",
      "CLOPS_FW"       = "YES",
      "map-migrated"   = "migKNBMDMW06I"
    }
  )
}

resource "aws_instance" "aomad2-txmgr-01" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "m5.xlarge"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-02e47972ad7b57ce8"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-0afe8d939051da794.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  user_data                   = <<-EOT
#!/bin/bash
echo ECS_CLUSTER=aomad2-txmgr-ecs >> /etc/ecs/ecs.config
EOT  
  tags = merge(
    var.common_tags,
    {
      "Name"           = "aomad2-txmgr-01",
      "Environment"    = "Dev",
      "SERVER_TYPE"    = "EC2",
      "OS"             = "AL3",
      "Patch Group"    = "General",
      "Business-Unit"  = "SME-AOMA-Core",
      "Project-Code"   = "SME-2000-0306A"
      "Project-Name"   = "AOMA-Core"
      "CLOPS_APPROVED" = "YES",
      "ME-Joined"      = "NO",
      "OPS"            = "STND",
      "DATA"           = "NORMAL",
      "Owner"          = "nathaniel.lovett@sonymusic.com",
      "Terraform"      = "True",
      "CLOPS_FW"       = "YES",
      "map-migrated"   = "migKNBMDMW06I"
    }
  )
  lifecycle { ignore_changes = [user_data] }
}

resource "aws_instance" "aomad2-txmgr-02" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "m5.xlarge"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-0efe522f1c5644b63"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-05e3533bcaefcddff.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  user_data                   = <<-EOT
#!/bin/bash
echo ECS_CLUSTER=aomad2-txmgr-ecs >> /etc/ecs/ecs.config
EOT  
  tags = merge(
    var.common_tags,
    {
      "Name"           = "aomad2-txmgr-02",
      "Environment"    = "Dev",
      "SERVER_TYPE"    = "EC2",
      "OS"             = "AL3",
      "Patch Group"    = "General",
      "Business-Unit"  = "SME-AOMA-Core",
      "Project-Code"   = "SME-2000-0306A"
      "Project-Name"   = "AOMA-Core"
      "CLOPS_APPROVED" = "YES",
      "ME-Joined"      = "NO",
      "OPS"            = "STND",
      "DATA"           = "NORMAL",
      "Owner"          = "nathaniel.lovett@sonymusic.com",
      "Terraform"      = "True",
      "CLOPS_FW"       = "YES",
      "map-migrated"   = "migKNBMDMW06I"
    }
  )
  lifecycle { ignore_changes = [user_data] }
}

resource "aws_instance" "aomad2-queue01" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "t3.medium"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-09aaa6a64f0725757"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-0afe8d939051da794.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  tags = merge(
    var.common_tags,
    {
      "Name"           = "aomad2-queue01",
      "Environment"    = "Dev",
      "SERVER_TYPE"    = "EC2",
      "OS"             = "AL3",
      "Patch Group"    = "General",
      "Business-Unit"  = "SME-AOMA-Core",
      "Project-Code"   = "SME-2000-0306A"
      "Project-Name"   = "AOMA-Core"
      "CLOPS_APPROVED" = "YES",
      "ME-Joined"      = "NO",
      "OPS"            = "STND",
      "DATA"           = "NORMAL",
      "Owner"          = "nathaniel.lovett@sonymusic.com",
      "Terraform"      = "True",
      "CLOPS_FW"       = "YES",
      "map-migrated"   = "migKNBMDMW06I"
    }
  )
  lifecycle { ignore_changes = [user_data] }
}

resource "aws_instance" "aomad2-txmgr-03" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "m5.xlarge"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-02e47972ad7b57ce8"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-0afe8d939051da794.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  user_data                   = <<-EOT
#!/bin/bash
echo ECS_CLUSTER=aomad2-txmgr-ecs >> /etc/ecs/ecs.config
EOT  
  tags = merge(
    var.common_tags,
    {
      "Name"           = "aomad2-txmgr-03",
      "Environment"    = "Dev",
      "SERVER_TYPE"    = "EC2",
      "OS"             = "AL3",
      "Patch Group"    = "General",
      "Business-Unit"  = "SME-AOMA-Core",
      "Project-Code"   = "SME-2000-0306A"
      "Project-Name"   = "AOMA-Core"
      "CLOPS_APPROVED" = "YES",
      "ME-Joined"      = "NO",
      "OPS"            = "STND",
      "DATA"           = "NORMAL",
      "Owner"          = "nathaniel.lovett@sonymusic.com",
      "Terraform"      = "True",
      "CLOPS_FW"       = "YES",
      "map-migrated"   = "migKNBMDMW06I"
    }
  )
  lifecycle { ignore_changes = [user_data] }
}

resource "aws_instance" "aomad2-txmgr-04" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "m5.xlarge"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-0efe522f1c5644b63"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-05e3533bcaefcddff.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  user_data                   = <<-EOT
#!/bin/bash
echo ECS_CLUSTER=aomad2-txmgr-ecs >> /etc/ecs/ecs.config
EOT  
  tags = merge(
    var.common_tags,
    {
      "Name"           = "aomad2-txmgr-04",
      "Environment"    = "Dev",
      "SERVER_TYPE"    = "EC2",
      "OS"             = "AL3",
      "Patch Group"    = "General",
      "Business-Unit"  = "SME-AOMA-Core",
      "Project-Code"   = "SME-2000-0306A"
      "Project-Name"   = "AOMA-Core"
      "CLOPS_APPROVED" = "YES",
      "ME-Joined"      = "NO",
      "OPS"            = "STND",
      "DATA"           = "NORMAL",
      "Owner"          = "nathaniel.lovett@sonymusic.com",
      "Terraform"      = "True",
      "CLOPS_FW"       = "YES",
      "map-migrated"   = "migKNBMDMW06I"
    }
  )
  lifecycle { ignore_changes = [user_data] }
}

resource "aws_instance" "aomad2-aspera01" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-064831802eae3c1b0"
  instance_type               = "m5.large"
  iam_instance_profile        = "aomad-aomad2-aspera01"
  vpc_security_group_ids      = [aws_security_group.AOMA-D2-ASPERA-SG.id]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-05683f17a210241cf.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  tags = merge(
    var.common_tags,
    {
      "Name"            = "aomad2-aspera01",
      "Environment"     = "Dev",
      "SERVER_TYPE"     = "EC2",
      "OS"              = "AL3",
      "Patch Group"     = "General",
      "Business-Unit"   = "SME-AOMA-Core",
      "Project-Code"    = "SME-2000-0306A"
      "Project-Name"    = "AOMA-Core"
      "CLOPS_APPROVED"  = "YES",
      "ME-Joined"       = "NO",
      "OPS"             = "STND",
      "DATA"            = "NORMAL",
      "Owner"           = "vivien.leung@sonymusic.com",
      "Terraform"       = "True",
      "CLOPS_FW"        = "YES",
      "map-migrated"    = "migKNBMDMW06I",
      "CRITICAL_ASSETS" = "YES"
    }
  )
  lifecycle { ignore_changes = [user_data] }
}


resource "aws_instance" "aomad-txmgr-usm-ecs-01" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "t3.medium"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-0efe522f1c5644b63"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-05e3533bcaefcddff.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  user_data                   = <<-EOT
#!/bin/bash
echo ECS_CLUSTER=aomad-txmgr-usm-ecs >> /etc/ecs/ecs.config
EOT
  tags = {
    "Name"           = "aomad-txmgr-usm-ecs-01",
    "Environment"    = "Dev",
    "SERVER_TYPE"    = "ECS",
    "OS"             = "AL3",
    "Patch Group"    = "General",
    "Business-Unit"  = "SME-AOMA-Core",
    "Project-Code"   = "SME-2000-0306A"
    "Project-Name"   = "AOMA-Core"
    "CLOPS_APPROVED" = "YES",
    "ME-Joined"      = "NO",
    "OPS"            = "STND",
    "DATA"           = "NORMAL",
    "Owner"          = "vivien.leung@sonymusic.com",
    "Terraform"      = "True",
    "CLOPS_FW"       = "YES",
    "map-migrated"   = "migKNBMDMW06I",
  }
  lifecycle { ignore_changes = [user_data] }
}


resource "aws_instance" "aomad-txmgr-kafka-consumer-ecs-01" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "t3.medium"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-0efe522f1c5644b63"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-05e3533bcaefcddff.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  user_data                   = <<-EOT
#!/bin/bash
echo ECS_CLUSTER=aomad-txmgr-kafka-consumer >> /etc/ecs/ecs.config
EOT
  tags = {
    "Name"           = "aomad-txmgr-kafka-consumer-ecs-01",
    "Environment"    = "Dev",
    "SERVER_TYPE"    = "ECS",
    "OS"             = "AL3",
    "Patch Group"    = "General",
    "Business-Unit"  = "SME-AOMA-Core",
    "Project-Code"   = "SME-2000-0306A"
    "Project-Name"   = "AOMA-Core"
    "CLOPS_APPROVED" = "YES",
    "ME-Joined"      = "NO",
    "OPS"            = "STND",
    "DATA"           = "NORMAL",
    "Owner"          = "vivien.leung@sonymusic.com",
    "Terraform"      = "True",
    "CLOPS_FW"       = "YES",
    "map-migrated"   = "migKNBMDMW06I",
  }
  lifecycle { ignore_changes = [user_data] }
}

resource "aws_instance" "aomad2-aoma-apps-ecs01" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "t3.medium"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-0efe522f1c5644b63"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-0afe8d939051da794.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  tags = {
    "Name"           = "aomad2-aoma-apps-ecs01",
    "Environment"    = "Dev",
    "SERVER_TYPE"    = "ECS",
    "OS"             = "AL3",
    "Patch Group"    = "General",
    "Business-Unit"  = "SME-AOMA-Core",
    "Project-Code"   = "SME-2000-0306A"
    "Project-Name"   = "AOMA-Core"
    "CLOPS_APPROVED" = "YES",
    "ME-Joined"      = "NO",
    "OPS"            = "STND",
    "DATA"           = "NORMAL",
    "Owner"          = "nathaniel.lovett@sonymusic.com",
    "Terraform"      = "True",
    "CLOPS_FW"       = "YES",
    "map-migrated"   = "migKNBMDMW06I",
  }
}

resource "aws_instance" "aomad2-aoma-apps-ecs02" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                         = "ami-0d3b821ab4fd68e18"
  instance_type               = "t3.medium"
  iam_instance_profile        = "aomad2-ECS-Instance-Role"
  vpc_security_group_ids      = ["sg-0efe522f1c5644b63"]
  disable_api_termination     = "true"
  subnet_id                   = aws_subnet.subnet-05e3533bcaefcddff.id
  associate_public_ip_address = "false"
  key_name                    = "aoma-d1-27May2019"
  tags = {
    "Name"           = "aomad2-aoma-apps-ecs02",
    "Environment"    = "Dev",
    "SERVER_TYPE"    = "ECS",
    "OS"             = "AL3",
    "Patch Group"    = "General",
    "Business-Unit"  = "SME-AOMA-Core",
    "Project-Code"   = "SME-2000-0306A"
    "Project-Name"   = "AOMA-Core"
    "CLOPS_APPROVED" = "YES",
    "ME-Joined"      = "NO",
    "OPS"            = "STND",
    "DATA"           = "NORMAL",
    "Owner"          = "nathaniel.lovett@sonymusic.com",
    "Terraform"      = "True",
    "CLOPS_FW"       = "YES",
    "map-migrated"   = "migKNBMDMW06I",
  }
}

resource "aws_instance" "sme-aoma-core-storage-gateway-dev-aws" {
  # 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_135: Ensure that EC2 is EBS optimized
  # checkov:skip=CKV_AWS_79: Ensure Instance Metadata Service Version 1 is not enabled
  # checkov:skip=CKV_AWS_126: Ensure that detailed monitoring is enabled for EC2 instances
  ami                  = "ami-0603844ad5cd3ec26"
  instance_type        = "m5.xlarge"
  iam_instance_profile = "sme-aoma-core-storage-gateway-dev-aws-instance-role"

  availability_zone      = "eu-central-1c"
  subnet_id              = aws_subnet.subnet-00e1abd0f0d804e4c.id
  vpc_security_group_ids = [aws_security_group.sme-aoma-core-storage-gateway-dev-aws-sg.id]

  key_name = "sgw-dev-aws-kp"
  tags = merge(
    var.common_tags,
    {
      "Name"           = "sme-aoma-core-storage-gateway-dev-aws",
      "Environment"    = "Dev",
      "SERVER_TYPE"    = "EC2",
      "OS"             = "AL3",
      "Patch Group"    = "General",
      "Business-Unit"  = "SME-AOMA-Core",
      "Project-Code"   = "SME-2000-0306A"
      "Project-Name"   = "AOMA-Core"
      "CLOPS_APPROVED" = "YES",
      "ME-Joined"      = "NO",
      "OPS"            = "STND",
      "DATA"           = "NORMAL",
      "Owner"          = "nathaniel.lovett@sonymusic.com",
      "Terraform"      = "True",
      "CLOPS_FW"       = "YES",
      "map-migrated"   = "migKNBMDMW06I"
    }
  )
}
