# aws_batch_compute_environment.media-conversion-batch-c5-on-demand-stage2:
resource "aws_batch_compute_environment" "media-conversion-batch-c5-on-demand-stage2" {
  compute_environment_name = "media-conversion-batch-c5-on-demand-stage2"
  service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
  state                    = "ENABLED"
  tags                     = {}
  tags_all                 = {}
  type                     = "MANAGED"
  update_policy {
    job_execution_timeout_minutes = 30
    terminate_jobs_on_update      = false
  }
  lifecycle {
    ignore_changes = [compute_resources[0].desired_vcpus]
  }
  compute_resources {
    allocation_strategy = "BEST_FIT_PROGRESSIVE"
    bid_percentage      = 0
    desired_vcpus       = 0
    instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
    instance_type = [
      "c6i.4xlarge",
      "c6i.8xlarge",
    ]
    max_vcpus = 128
    min_vcpus = 0
    security_group_ids = [
      "sg-02e4e50fae9a3ced3",
    ]
    subnets = [
      "subnet-0a4f3a3999182f59c",
      "subnet-0af0388e06356271c",
    ]
    tags = merge(
      var.batch-tags,
      {
        "Name"         = "aws-batch-instance-on-demand-stage"
        "map-migrated" = "migKNBMDMW06I"
    })
    type = "EC2"

    ec2_configuration {
      image_type = "ECS_AL2"
    }

    launch_template {
      launch_template_name = "media-conversion-batch-c5-template"
      version              = "$Latest"
    }
  }
}
# aws_batch_compute_environment.media-conversion-batch-c5-emergency-stage2:
resource "aws_batch_compute_environment" "media-conversion-batch-c5-emergency-stage2" {
  compute_environment_name = "media-conversion-batch-c5-emergency-stage2"
  service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
  state                    = "ENABLED"
  tags                     = {}
  tags_all                 = {}
  type                     = "MANAGED"
  update_policy {
    job_execution_timeout_minutes = 30
    terminate_jobs_on_update      = false
  }
  lifecycle {
    ignore_changes = [compute_resources[0].desired_vcpus]
  }

  compute_resources {
    allocation_strategy = "BEST_FIT_PROGRESSIVE"
    bid_percentage      = 0
    desired_vcpus       = 0
    instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
    instance_type = [
      "c6i.4xlarge",
      "c6i.8xlarge",
    ]
    max_vcpus = 32
    min_vcpus = 0
    security_group_ids = [
      "sg-02e4e50fae9a3ced3",
    ]
    subnets = [
      "subnet-0a4f3a3999182f59c",
      "subnet-0af0388e06356271c",
    ]
    tags = merge(
      var.batch-tags,
      {
        "Name"         = "aws-batch-instance-emergency-stage"
        "map-migrated" = "migKNBMDMW06I"
    })
    type = "EC2"

    ec2_configuration {
      image_type = "ECS_AL2"
    }

    launch_template {
      launch_template_name = "media-conversion-batch-c5-template"
      version              = "$Latest"
    }
  }
}
# aws_batch_compute_environment.media-conversion-batch-c5-spot-stage2:
resource "aws_batch_compute_environment" "media-conversion-batch-c5-spot-stage2" {
  compute_environment_name = "media-conversion-batch-c5-spot-stage2"
  service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
  state                    = "ENABLED"
  tags                     = {}
  tags_all                 = {}
  type                     = "MANAGED"
  update_policy {
    job_execution_timeout_minutes = 30
    terminate_jobs_on_update      = false
  }
  lifecycle {
    ignore_changes = [compute_resources[0].desired_vcpus]
  }

  compute_resources {
    allocation_strategy = "SPOT_PRICE_CAPACITY_OPTIMIZED"
    bid_percentage      = 50
    desired_vcpus       = 0
    instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
    instance_type = [
      "c5.4xlarge",
      "c5.9xlarge",
      "c6i.4xlarge",
      "c6i.8xlarge",
      "c7i-flex.4xlarge",
      "c7i-flex.8xlarge",
      "c7i.4xlarge",
      "c7i.8xlarge",
      "m5.4xlarge",
      "m5.8xlarge"
    ]
    max_vcpus = 32
    min_vcpus = 0
    security_group_ids = [
      "sg-02e4e50fae9a3ced3",
    ]
    subnets = [
      "subnet-0a4f3a3999182f59c",
      "subnet-0af0388e06356271c",
    ]
    tags = merge(
      var.batch-tags,
      {
        "Name"         = "aws-batch-instance-spot-stage"
        "map-migrated" = "migKNBMDMW06I"
    })
    type = "SPOT"

    ec2_configuration {
      image_type = "ECS_AL2"
    }

    launch_template {
      launch_template_name = "media-conversion-batch-c5-template"
      version              = "$Latest"
    }
  }
}

# ### aws_batch_compute_environment.media-conversion-batch-c5-on-demand-uat-01:
# resource "aws_batch_compute_environment" "media-conversion-batch-c5-on-demand-uat-01" {
#    compute_environment_name = "media-conversion-batch-c5-on-demand-uat-01"
#    service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
#    state                    = "ENABLED"
#    tags                     = {}
#    tags_all                 = {}
#    type                     = "MANAGED"
#    lifecycle {
#        ignore_changes = [compute_resources[0].desired_vcpus]
#    }
#    compute_resources {
#        allocation_strategy = "BEST_FIT_PROGRESSIVE"
#        bid_percentage      = 0
#        desired_vcpus       = 0
#        instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
#        instance_type       = ["c6i.4xlarge", "c6i.8xlarge"]
#        max_vcpus           = 2048
#        min_vcpus           = 0
#        security_group_ids  = [
#            "sg-0d95b30c4fd85e01e",
#        ]
#        subnets             = [
#            "subnet-035c9fb62cdc3de7a",
#            "subnet-0268d30c7f0c8367f",
#        ]
#        tags                = {
#            "Name" = "aws-batch-instance-on-demand-uat-01"
#            "map-migrated" = "migKNBMDMW06I"
#        }
#        type                = "EC2"#
#        ec2_configuration {
#            image_type = "ECS_AL2"
#        }
#        launch_template {
#            launch_template_name = "media-conversion-batch-c5-template"
#            version              = "$Latest"
#        }
#    }
# }#

# # aws_batch_compute_environment.media-conversion-batch-c5-emergency-uat-01:
# resource "aws_batch_compute_environment" "media-conversion-batch-c5-emergency-uat-01" {
#    compute_environment_name = "media-conversion-batch-c5-emergency-uat-01"
#    service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
#    state                    = "ENABLED"
#    tags                     = {}
#    tags_all                 = {}
#    type                     = "MANAGED"
#    lifecycle {
#        ignore_changes = [compute_resources[0].desired_vcpus]
#    }

#    compute_resources {
#        allocation_strategy = "BEST_FIT_PROGRESSIVE"
#        bid_percentage      = 0
#        desired_vcpus       = 0
#        instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
#        instance_type       = ["c6i.4xlarge", "c6i.8xlarge"]
#        max_vcpus           = 2048
#        min_vcpus           = 0
#        security_group_ids  = [
#            "sg-0d95b30c4fd85e01e",
#        ]
#        subnets             = [
#            "subnet-035c9fb62cdc3de7a",
#            "subnet-0268d30c7f0c8367f",
#        ]
#        tags                = {
#            "Name" = "aws-batch-instance-emergency-uat-01"
#            "map-migrated" = "migKNBMDMW06I"
#        }
#        type                = "EC2"
#        ec2_configuration {
#            image_type = "ECS_AL2"
#        } 
#        launch_template {
#            launch_template_name = "media-conversion-batch-c5-template"
#            version              = "$Latest"
#        }
#    }
# }#

# # aws_batch_compute_environment.media-conversion-batch-c5-spot-uat-01:
# resource "aws_batch_compute_environment" "media-conversion-batch-c5-spot-uat-01" {
#    compute_environment_name = "media-conversion-batch-c5-spot-uat-01"
#    service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
#    state                    = "ENABLED"
#    tags                     = {}
#    tags_all                 = {}
#    type                     = "MANAGED"
#    lifecycle {
#        ignore_changes = [compute_resources[0].desired_vcpus]
#    }

#    compute_resources {
#        allocation_strategy = "SPOT_CAPACITY_OPTIMIZED"
#        bid_percentage      = 50
#        desired_vcpus       = 0
#        instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
#        instance_type       = ["c6i.4xlarge", "c6i.8xlarge"]
#        max_vcpus           = 2048
#        min_vcpus           = 0
#        security_group_ids  = [
#            "sg-0d95b30c4fd85e01e",
#        ]
#        subnets             = [
#            "subnet-035c9fb62cdc3de7a",
#            "subnet-0268d30c7f0c8367f",
#        ]
#        tags                = {
#            "Name" = "aws-batch-instance-spot-uat-01"
#            "map-migrated" = "migKNBMDMW06I"
#        }
#        type                = "SPOT"#
#        ec2_configuration {
#            image_type = "ECS_AL2"
#        }
#        launch_template {
#            launch_template_name = "media-conversion-batch-c5-template"
#            version              = "$Latest"
#        }
#    }
# }

#aws_batch_compute_environment.media-conversion-batch-c5-on-demand-uat-01:
# resource "aws_batch_compute_environment" "media-conversion-batch-c5-on-demand-uat-lp-01" {
#    compute_environment_name = "media-conversion-batch-c5-on-demand-uat-lp-01"
#    service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
#    state                    = "ENABLED"
#    tags                     = {}
#    tags_all                 = {}
#    type                     = "MANAGED"
#    lifecycle {
#        ignore_changes = [compute_resources[0].desired_vcpus]
#    }
#    compute_resources {
#        allocation_strategy = "BEST_FIT_PROGRESSIVE"
#        bid_percentage      = 0
#        desired_vcpus       = 0
#        instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
#        instance_type = [
#          "c6i.4xlarge",
#          "c6i.8xlarge",
#          "c6i.12xlarge",
#        ]
#        max_vcpus           = 2048
#        min_vcpus           = 0
#        security_group_ids  = [
#            "sg-07bef6cfe6675ce05",
#        ]
#        subnets             = [
#            "subnet-0f6744bd0396ca5e7",
#            "subnet-0af98b0984c704a3b",
#        ]
#        tags                = {
#            "Name" = "aws-batch-instance-on-demand-uat-lp-01"
#            "map-migrated" = "migKNBMDMW06I"
#        }
#        type                = "EC2"#

#        ec2_configuration {
#            image_type = "ECS_AL2"
#        }#

#        launch_template {
#            launch_template_name = "media-conversion-batch-c5-template"
#            version              = "$Latest"
#        }
#    }
# }#

# #aws_batch_compute_environment.media-conversion-batch-c5-emergency-uat-01:
# resource "aws_batch_compute_environment" "media-conversion-batch-c5-emergency-uat-lp-01" {
#    compute_environment_name = "media-conversion-batch-c5-emergency-uat-lp-01"
#    service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
#    state                    = "ENABLED"
#    tags                     = {}
#    tags_all                 = {}
#    type                     = "MANAGED"
#    lifecycle {
#        ignore_changes = [compute_resources[0].desired_vcpus]
#    }

#    compute_resources {
#        allocation_strategy = "BEST_FIT_PROGRESSIVE"
#        bid_percentage      = 0
#        desired_vcpus       = 0
#        instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
#        instance_type = [
#          "c6i.4xlarge",
#          "c6i.8xlarge",
#          "c6i.12xlarge",
#        ]
#        max_vcpus           = 2048
#        min_vcpus           = 0
#        security_group_ids  = [
#            "sg-07bef6cfe6675ce05",
#        ]
#        subnets             = [
#            "subnet-0f6744bd0396ca5e7",
#            "subnet-0af98b0984c704a3b",
#        ]
#        tags                = {
#            "Name" = "aws-batch-instance-emergency-uat-lp-01"
#            "map-migrated" = "migKNBMDMW06I"
#        }
#        type                = "EC2"#

#        ec2_configuration {
#            image_type = "ECS_AL2"
#        }#

#        launch_template {
#            launch_template_name = "media-conversion-batch-c5-template"
#            version              = "$Latest"
#        }
#    }
# }
# #aws_batch_compute_environment.media-conversion-batch-c5-spot-uat-01:
# resource "aws_batch_compute_environment" "media-conversion-batch-c5-spot-uat-lp-01" {
#    compute_environment_name = "media-conversion-batch-c5-spot-uat-lp-01"
#    service_role             = "arn:aws:iam::104858398257:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch"
#    state                    = "ENABLED"
#    tags                     = {}
#    tags_all                 = {}
#    type                     = "MANAGED"
#    lifecycle {
#        ignore_changes = [compute_resources[0].desired_vcpus]
#    }

#    compute_resources {
#        allocation_strategy = "SPOT_CAPACITY_OPTIMIZED"
#        bid_percentage      = 50
#        desired_vcpus       = 0
#        instance_role       = "arn:aws:iam::104858398257:instance-profile/ecsInstanceRole"
#        instance_type = [
#          "c6i.4xlarge",
#          "c6i.8xlarge",
#          "c6i.12xlarge",
#        ]
#        max_vcpus           = 2048
#        min_vcpus           = 0
#        security_group_ids  = [
#            "sg-07bef6cfe6675ce05",
#        ]
#        subnets             = [
#            "subnet-0f6744bd0396ca5e7",
#            "subnet-0af98b0984c704a3b",
#        ]
#        tags = merge(
#      var.batch-tags,
#     {
#            "Name" = "aws-batch-instance-spot-uat-lp-01"
#            "map-migrated" = "migKNBMDMW06I"
#        })
#        type                = "SPOT"#

#        ec2_configuration {
#            image_type = "ECS_AL2"
#        }#

#        launch_template {
#            launch_template_name = "media-conversion-batch-c5-template"
#            version              = "$Latest"
#        }
#    }
# }
