---
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 contains at least one container configured to run in privileged mode."
    remediationMessage: "Create a new revision of the Task Definition with 'privileged' set to false for all containers."
    check:
      RELATED_LIST_HAS:
        status: "INCOMPLIANT"
        relationshipName: "CA10__AWS_ECS_Container_Definitions__r"
otherwise:
  status: "COMPLIANT"
  currentStateMessage: "No containers in the Task Definition are configured to run in privileged mode."
relatedLists:
  - relationshipName: "CA10__AWS_ECS_Container_Definitions__r"
    conditions:
      - status: "INCOMPLIANT"
        currentStateMessage: "The container is given elevated privileges on the host container instance."
        check:
          EXTRACT: "CA10__privileged__c"
    otherwise:
      status: "COMPLIANT"
      currentStateMessage: "The container does not run in privileged mode."