---
inputType: "CA10__CaAwsEcsTaskDefinition__c"
testData:
  - file: "test-data.json"
importExtracts:
  - file: "/types/CA10__CaAwsEcsTaskDefinition__c/object.extracts.yaml"
  - file: "/types/CA10__CaAwsEcsContainerDefinition__c/object.extracts.yaml"
conditions:
  - status: "INAPPLICABLE"
    currentStateMessage: "The Task Definition is not active."
    check:
      NOT_EQUAL:
        left:
          EXTRACT: "CA10__status__c"
        right:
          TEXT: "ACTIVE"
  - status: "INCOMPLIANT"
    currentStateMessage: "The Task Definition has at least one container without a log configuration."
    remediationMessage: "Configure a log driver (e.g., awslogs) for all containers in the Task Definition."
    check:
      RELATED_LIST_HAS:
        status: "INCOMPLIANT"
        relationshipName: "CA10__AWS_ECS_Container_Definitions__r"
otherwise:
  status: "COMPLIANT"
  currentStateMessage: "All containers in the Task Definition have a log configuration."
relatedLists:
  - relationshipName: "CA10__AWS_ECS_Container_Definitions__r"
    conditions:
      - status: "INCOMPLIANT"
        currentStateMessage: "The container logging is not configured."
        check:
          IS_EMPTY:
            arg:
              EXTRACT: "CA10__logConfigurationDriver__c"
    otherwise:
      status: "COMPLIANT"
      currentStateMessage: "The container logging is configured."