--- policy: /ce/ca/aws/autoscaling/group-with-elb-without-elb-health-check logic: /ce/ca/aws/autoscaling/group-with-elb-without-elb-health-check/prod.logic.yaml executionTime: 2026-06-06T12:02:31.425922662Z generationMs: 51 executionMs: 1132 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT) actual: CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT) runtimeError: {} - id: test3 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT) actual: CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT) runtimeError: {} - id: test4 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT) actual: CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT) runtimeError: {} - id: test5 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: not(extract('CA10__healthCheckType__c').contains('ELB')) actual: not(extract('CA10__healthCheckType__c').contains('ELB')) runtimeError: {} - id: test6 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__healthCheckType__c').contains('ELB') actual: extract('CA10__healthCheckType__c').contains('ELB') runtimeError: {} usedFiles: - path: /ce/ca/aws/autoscaling/group-with-elb-without-elb-health-check/policy.yaml md5Hash: 0DCD446A842F217D613CBD8EAFE3C85D content: "---\nnames:\n full: AWS EC2 Auto Scaling Group behind ELB doesn't use\ \ ELB health check\n contextual: Auto Scaling Group behind ELB doesn't use\ \ ELB health check\ndescription: >\n Ensure that Auto Scaling Groups associated\ \ with Elastic Load Balancers (ELBs) are configured \n to use ELB health checks\ \ instead of EC2 health checks. ELB health checks provide more \n accurate\ \ health status for instances behind a load balancer.\ncategories:\n - \"RELIABILITY\"\ \ntype: \"COMPLIANCE_POLICY\"\nframeworkMappings:\n - \"/frameworks/cloudaware/resource-reliability/system-configuration\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/auto-scaling/01\"\n - \"/frameworks/aws-well-architected/rel/06/04\"\ \n - \"/frameworks/aws-well-architected/rel/07/02\"\n - \"/frameworks/aws-well-architected/rel/11/01\"\ \n - \"/frameworks/aws-well-architected/rel/11/03\"\nsimilarPolicies:\n internal:\n\ \ - dec-x-71d45f32 " - path: /ce/ca/aws/autoscaling/group-with-elb-without-elb-health-check/prod.logic.yaml md5Hash: D12A148D039518DE54F61BDA488A0BD4 content: | --- inputType: "CA10__CaAwsAutoScalingGroup__c" importExtracts: - file: "/types/CA10__CaAwsAutoScalingGroupTrafficSourceLink__c/object.extracts.yaml" - file: "/types/CA10__CaAwsAutoScalingGroup__c/object.extracts.yaml" testData: - file: "test-data.json" conditions: - status: "INAPPLICABLE" currentStateMessage: "The ASG is not associated with a load balancer." check: RELATED_LIST_HAS_NO: relationshipName: "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r" status: "COMPLIANT" - status: "INCOMPLIANT" currentStateMessage: "The ASG behind an ELB does not use ELB health checks." remediationMessage: "Configure the Auto Scaling group to use ELB health checks." check: NOT: arg: CONTAINS: arg: EXTRACT: "CA10__healthCheckType__c" search: TEXT: "ELB" - status: "COMPLIANT" currentStateMessage: "The ASG uses ELB health checks." check: CONTAINS: arg: EXTRACT: "CA10__healthCheckType__c" search: TEXT: "ELB" otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the fields." relatedLists: - relationshipName: "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r" conditions: - status: "COMPLIANT" currentStateMessage: "The ASG traffic source is a Classic Load Balancer." check: IS_EQUAL: left: EXTRACT: "CA10__trafficSourceType__c" right: TEXT: "elb" - status: "COMPLIANT" currentStateMessage: "The ASG traffic source is an ELB target group." check: IS_EQUAL: left: EXTRACT: "CA10__trafficSourceType__c" right: TEXT: "elbv2" otherwise: status: "INAPPLICABLE" currentStateMessage: "Unrelated ASG traffic source." - path: /ce/ca/aws/autoscaling/group-with-elb-without-elb-health-check/test-data.json md5Hash: C079D116AE211EE68A573FA2AE2008B0 content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-04-15T22:26:01Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2025-04-07T08:34:09Z", "CA10__healthCheckType__c": "EC2", "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r": [ { "Id": "test1_1", "CA10__disappearanceTime__c": "2025-04-07T08:34:09Z", "CA10__trafficSourceType__c": "elbv2", "CA10__autoScalingGroup__c": "test1" } ] }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-04-15T22:26:01Z" }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__healthCheckType__c": "EC2", "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r": [] }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-04-15T22:26:01Z" }, "Id": "test3", "CA10__disappearanceTime__c": null, "CA10__healthCheckType__c": "EC2", "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r": [ { "Id": "test3_1", "CA10__disappearanceTime__c": "2025-04-07T08:34:09Z", "CA10__trafficSourceType__c": "elbv2", "CA10__autoScalingGroup__c": "test3" } ] }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-04-15T22:26:01Z" }, "Id": "test4", "CA10__disappearanceTime__c": null, "CA10__healthCheckType__c": "EC2", "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r": [ { "Id": "test4_1", "CA10__disappearanceTime__c": null, "CA10__trafficSourceType__c": "vpc-lattice", "CA10__autoScalingGroup__c": "test4" } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "not(extract('CA10__healthCheckType__c').contains('ELB'))", "runtimeError": null }, "context": { "snapshotTime": "2025-04-15T22:26:01Z" }, "Id": "test5", "CA10__disappearanceTime__c": null, "CA10__healthCheckType__c": "EC2", "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r": [ { "Id": "test5_1", "CA10__disappearanceTime__c": null, "CA10__trafficSourceType__c": "elbv2", "CA10__autoScalingGroup__c": "test5" } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "399", "conditionText": "extract('CA10__healthCheckType__c').contains('ELB')", "runtimeError": null }, "context": { "snapshotTime": "2025-04-15T22:26:01Z" }, "Id": "test6", "CA10__disappearanceTime__c": null, "CA10__healthCheckType__c": "ELB", "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r": [ { "Id": "test6_1", "CA10__disappearanceTime__c": null, "CA10__trafficSourceType__c": "elb", "CA10__autoScalingGroup__c": "test6" } ] } ] - path: /types/CA10__CaAwsAutoScalingGroup__c/object.extracts.yaml md5Hash: DD26D73C0CF43F8CE9CBE35D8241D89C content: "---\nextracts:\n # AvailabilityZones.member.N\n # One or more Availability\ \ Zones for the group.\n # Type: Array of strings\n # Length Constraints:\ \ Minimum length of 1. Maximum length of 255.\n # Pattern: [\\u0020-\\uD7FF\\\ uE000-\\uFFFD\\uD800\\uDC00-\\uDBFF\\uDFFF\\r\\n\\t]*\n # Required: Yes\n \ \ - name: CA10__availabilityZones__c\n value: \n FIELD:\n path:\ \ CA10__availabilityZones__c\n undeterminedIf:\n isEmpty: Corrupted\ \ data. Availability zones should always present\n - name: caSetFrom_availabilityZones__c\n\ \ value: \n SET_FROM:\n separator: \"\\n\"\n arg:\n \ \ EXTRACT: CA10__availabilityZones__c\n# A comma-separated value string\ \ of one or more health check types.\n# Values: EC2, EBS, ELB, VPC_LATTICE.\ \ Not nullable. Can't have no access, retrieved via autoscaling:DescribeAutoScalingGroups\n\ \ - name: CA10__healthCheckType__c\n value: \n FIELD:\n path:\ \ CA10__healthCheckType__c \n# Nullable. Can't have no access, retrieved\ \ via autoscaling:DescribeAutoScalingGroups \n - name: CA10__launchConfigurationName__c\n\ \ value: \n FIELD:\n path: CA10__launchConfigurationName__c \ \ \n# Nullable. Can't have no access, retrieved via autoscaling:DescribeAutoScalingGroups\ \ \n - name: CA10A1__launchTemplateId__c\n value: \n FIELD:\n \ \ path: CA10A1__launchTemplateId__c \n# Nullable. Can't have\ \ no access, retrieved via autoscaling:DescribeAutoScalingGroups \n - name:\ \ CA10A1__mixedInstancesLaunchTemplateId__c\n value: \n FIELD:\n \ \ path: CA10A1__mixedInstancesLaunchTemplateId__c \n# Values: Enable\ \ | Disable. Nullable, null == Disable. Can't have no access, retrieved via\ \ autoscaling:DescribeAutoScalingGroups \n - name: CA10__capacityRebalancing__c\n\ \ value: \n FIELD:\n path: CA10__capacityRebalancing__c \ \ \n" - path: /types/CA10__CaAwsAutoScalingGroupTrafficSourceLink__c/object.extracts.yaml md5Hash: 5D75919837EC6FE643E714B0EB120E9F content: "---\nextracts:\n# Values: elb, elbv2, vpc-lattice. Not Nullable. Can't\ \ have no access, retrieved via autoscaling:DescribeAutoScalingGroups\n - name:\ \ CA10__trafficSourceType__c\n value: \n FIELD:\n path: CA10__trafficSourceType__c\n\ \ undeterminedIf:\n isEmpty: \"Possibly corrupted data. Traffic\ \ source type cannot be empty.\"" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "not(extract('CA10__healthCheckType__c').contains('ELB'))", "runtimeError" : null } }, { "Id" : "test6", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('CA10__healthCheckType__c').contains('ELB')", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsAutoScalingGroup__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__disappearanceTime__c" : new Date("2025-04-07T08:34:09Z"), "CA10__healthCheckType__c" : "EC2", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__healthCheckType__c" : "EC2", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__healthCheckType__c" : "EC2", "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__healthCheckType__c" : "EC2", "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__healthCheckType__c" : "EC2", "Id" : "test5" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__healthCheckType__c" : "ELB", "Id" : "test6" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsAutoScalingGroupTrafficSourceLink__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__disappearanceTime__c" : new Date("2025-04-07T08:34:09Z"), "CA10__trafficSourceType__c" : "elbv2", "CA10__autoScalingGroup__c" : "test1", "Id" : "test1_1" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__disappearanceTime__c" : new Date("2025-04-07T08:34:09Z"), "CA10__trafficSourceType__c" : "elbv2", "CA10__autoScalingGroup__c" : "test3", "Id" : "test3_1" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__trafficSourceType__c" : "vpc-lattice", "CA10__autoScalingGroup__c" : "test4", "Id" : "test4_1" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__trafficSourceType__c" : "elbv2", "CA10__autoScalingGroup__c" : "test5", "Id" : "test5_1" }, { "context" : { "snapshotTime" : new Date("2025-04-15T22:26:01Z") }, "CA10__trafficSourceType__c" : "elb", "CA10__autoScalingGroup__c" : "test6", "Id" : "test6_1" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsAutoScalingGroup__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__healthCheckType__c STRING, CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r ARRAY >>, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r_COMPLIANT2 = 0; if (obj.CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r != null) { for (var i3 = 0; i3 < obj.CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.length; i3++) { if (typeof(obj.CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r[i3].status) !== 'undefined') { if (obj.CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r[i3].status == 'COMPLIANT') { count_CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r_COMPLIANT2 += obj.CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r[i3].count; } } else { if (obj.CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r[i3].result.status == 'COMPLIANT') { count_CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r_COMPLIANT2 += 1; } } } } // condition[1], conditionIndex:[100..199] references1.push('Related list [CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r] ' + (count_CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r_COMPLIANT2 == 0 ? 'does not have' : 'has') + ' objects in COMPLIANT status'); if (count_CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r_COMPLIANT2 == 0) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r.hasNo(COMPLIANT)", currentStateMessage: "The ASG is not associated with a load balancer.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract5() { if (!this.out) { this.out = obj.CA10__healthCheckType__c; } return this.out; }; references1.push('Health Check Type [obj.CA10__healthCheckType__c]: ' + obj.CA10__healthCheckType__c); if (!TextLib.contains(extract5.call(extract5), 'ELB')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "not(extract('CA10__healthCheckType__c').contains('ELB'))", currentStateMessage: "The ASG behind an ELB does not use ELB health checks.", currentStateReferences: references1.join('\n'), remediation: "Configure the Auto Scaling group to use ELB health checks.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract8() { if (!this.out) { this.out = obj.CA10__healthCheckType__c; } return this.out; }; if (TextLib.contains(extract8.call(extract8), 'ELB')) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__healthCheckType__c').contains('ELB')", currentStateMessage: "The ASG uses ELB health checks.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "Unexpected values in the fields.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__trafficSourceType__c STRING, CA10__autoScalingGroup__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function fieldChecked4() { if (TextLib.isEmpty(obj.CA10__trafficSourceType__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__trafficSourceType__c.isEmpty()", currentStateMessage: "Possibly corrupted data. Traffic source type cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__trafficSourceType__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Traffic Source Type [obj.CA10__trafficSourceType__c]: ' + obj.CA10__trafficSourceType__c); try { if (TextLib.equal(extract3.call(extract3), 'elb')) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__trafficSourceType__c') == 'elb'", currentStateMessage: "The ASG traffic source is a Classic Load Balancer.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function fieldChecked7() { if (TextLib.isEmpty(obj.CA10__trafficSourceType__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__trafficSourceType__c.isEmpty()", currentStateMessage: "Possibly corrupted data. Traffic source type cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__trafficSourceType__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; try { if (TextLib.equal(extract6.call(extract6), 'elbv2')) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__trafficSourceType__c') == 'elbv2'", currentStateMessage: "The ASG traffic source is an ELB target group.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } return {status: 'INAPPLICABLE', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "Unrelated ASG traffic source.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; SELECT expectedResult.Id as Id, IF ( IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '') AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1) AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '') AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''), "MATCH", "FAIL" ) as match, expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus, expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex, expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText, expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError FROM UNNEST(mock_ExpectedResult()) expectedResult LEFT JOIN ( SELECT sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__healthCheckType__c AS CA10__healthCheckType__c, `CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r`.arr AS CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r, sObject.Id AS Id, process_CA10__CaAwsAutoScalingGroup__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__healthCheckType__c AS CA10__healthCheckType__c, `CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r`.arr AS CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsAutoScalingGroup__c()) AS sObject LEFT JOIN ( SELECT sObject.CA10__autoScalingGroup__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__trafficSourceType__c AS CA10__trafficSourceType__c, sObject.CA10__autoScalingGroup__c AS CA10__autoScalingGroup__c, sObject.Id AS Id, process_CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__trafficSourceType__c AS CA10__trafficSourceType__c, sObject.CA10__autoScalingGroup__c AS CA10__autoScalingGroup__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsAutoScalingGroupTrafficSourceLink__c()) AS sObject GROUP BY sObject.CA10__autoScalingGroup__c ) AS `CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r` ON sObject.Id = `CA10__AWS_EC2_Auto_Scaling_Group_Tfc_Src_Links__r`.CA10__autoScalingGroup__c ) sObject ON sObject.Id = expectedResult.Id;