# stacks/shared-ecs-cluster.yml
AWSTemplateFormatVersion: "2010-09-09"

Description: >- # TODO
  tktktk

Parameters:
  EnvironmentType: { Type: String }

Resources:
  EcsCluster:
    Type: AWS::ECS::Cluster
    Properties:
      Tags:
        - Key: Project
          Value: platform.prx.org
        - Key: Environment
          Value: !Ref EnvironmentType
        - Key: prx:cloudformation:stack-name
          Value: !Ref AWS::StackName
        - Key: prx:cloudformation:stack-id
          Value: !Ref AWS::StackId

Outputs:
  EcsClusterName:
    Description: >-
      The resource name of the ECS cluster, such as
      MyStack-MyCluster-NT5EUXTN176T
    Value: !Ref EcsCluster
  EcsClusterArn:
    Description: >-
      The Amazon Resource Name (ARN) of the Amazon ECS cluster, such as
      arn:aws:ecs:us-east-2:123456789012:cluster/MyECSCluster
    Value: !GetAtt EcsCluster.Arn

# stacks/shared-ecs-cluster.yml
AWSTemplateFormatVersion: "2010-09-09"

Description: >- # TODO
  tktktk

Parameters:
  EnvironmentType: { Type: String }

Conditions:
  IsProduction: !Equals [!Ref EnvironmentType, Production]

Resources:
  EcsCluster:
    Type: AWS::ECS::Cluster
    Properties:
      ClusterSettings:
        - Name: containerInsights
          Value: !If [IsProduction, enabled, disabled]
      Tags:
        - Key: Project
          Value: platform.prx.org
        - Key: Environment
          Value: !Ref EnvironmentType
        - Key: prx:cloudformation:stack-name
          Value: !Ref AWS::StackName
        - Key: prx:cloudformation:stack-id
          Value: !Ref AWS::StackId

Outputs:
  EcsClusterName:
    Description: >-
      The resource name of the ECS cluster, such as
      MyStack-MyCluster-NT5EUXTN176T
    Value: !Ref EcsCluster
  EcsClusterArn:
    Description: >-
      The Amazon Resource Name (ARN) of the Amazon ECS cluster, such as
      arn:aws:ecs:us-east-2:123456789012:cluster/MyECSCluster
    Value: !GetAtt EcsCluster.Arn

Enable container insights in production
Enable container insights in production
