---
inputType: "CA10__CaAwsInstance__c"
importExtracts:
  - file: "/types/CA10__CaAwsInstance__c/object.extracts.yaml"
testData:
  - file: 'test-data.json'
conditions:
  - status: "INAPPLICABLE"
    currentStateMessage: "The instance is not running."
    check:
      NOT_EQUAL:
        left:
          EXTRACT: "CA10__stateName__c"
        right:
          TEXT: "running"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in us-west-1 which is more expensive than us-west-2."
    remediationMessage: "Consider migrating the instance to us-west-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "us-west-1"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in ca-west-1 which is more expensive than us-west-2."
    remediationMessage: "Consider migrating the instance to us-west-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "ca-west-1"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in ap-northeast-1 which is more expensive than ap-northeast-2."
    remediationMessage: "Consider migrating the instance to ap-northeast-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "ap-northeast-1"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in ap-northeast-3 which is more expensive than ap-northeast-2."
    remediationMessage: "Consider migrating the instance to ap-northeast-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "ap-northeast-3"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in ca-central-1 which is more expensive than us-east-2."
    remediationMessage: "Consider migrating the instance to us-east-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "ca-central-1"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in eu-central-1 which is more expensive than eu-west-1, eu-north-1, or eu-south-2."
    remediationMessage: "Consider migrating the instance to eu-west-1, eu-north-1, or eu-south-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "eu-central-1"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in eu-west-2 which is more expensive than eu-west-1, eu-north-1, or eu-south-2."
    remediationMessage: "Consider migrating the instance to eu-west-1, eu-north-1, or eu-south-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "eu-west-2"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in eu-south-1 which is more expensive than eu-west-1, eu-north-1, or eu-south-2."
    remediationMessage: "Consider migrating the instance to eu-west-1, eu-north-1, or eu-south-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "eu-south-1"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in eu-west-3 which is more expensive than eu-west-1, eu-north-1, or eu-south-2."
    remediationMessage: "Consider migrating the instance to eu-west-1, eu-north-1, or eu-south-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "eu-west-3"
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is running in eu-central-2 which is more expensive than eu-west-1, eu-north-1, or eu-south-2."
    remediationMessage: "Consider migrating the instance to eu-west-1, eu-north-1, or eu-south-2."
    check:
      IS_EQUAL:
        left:
          EXTRACT: CA10__regionName__c
        right:
          TEXT: "eu-central-2"
otherwise:
  status: "COMPLIANT"
  currentStateMessage: "The EC2 instance is located in a cost-effective region."
