This template demonstrates how to tag an ECS cluster that is implicitly created by an AWS Batch Compute Environment using the aws_ecs_tag resource.

Terraform Template

resource "aws_batch_compute_environment" "example" {
  compute_environment_name = "example"
  service_role = "aws_iam_role.example.arn"
  type = "UNMANAGED"
}

resource "aws_ecs_tag" "example" {
  key = "Name"
  resource_arn = aws_batch_compute_environment.example.ecs_cluster_arn
  value = "Hello World"
}