--- policy: /ce/ca/aws/connect/instance-flow-logs logic: /ce/ca/aws/connect/instance-flow-logs/prod.logic.yaml executionTime: 2026-05-09T12:02:24.497998893Z generationMs: 55 executionMs: 2018 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10A1__disappearanceTime__c) actual: isDisappeared(CA10A1__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - false') actual: extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - false') runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - true') actual: extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - true') runtimeError: {} - id: test4 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/aws/connect/instance-flow-logs/policy.yaml md5Hash: B164FCBFEF53322EC8EE207FA241F187 content: |- --- names: full: AWS Connect Instance flow logs are not enabled contextual: Instance flow logs are not enabled description: > Ensure that Amazon Connect Instances have CloudWatch logging enabled to capture contact flow logs. type: COMPLIANCE_POLICY categories: - "SECURITY" - "RELIABILITY" frameworkMappings: - "/frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration" - "/frameworks/aws-fsbp-v1.0.0/connect/02" similarPolicies: awsSecurityHub: - name: "[Connect.2] Amazon Connect instances should have CloudWatch logging enabled" url: "https://docs.aws.amazon.com/securityhub/latest/userguide/connect-controls.html#connect-2" - path: /ce/ca/aws/connect/instance-flow-logs/prod.logic.yaml md5Hash: 33857D1FCC5D608277B862F9243863D4 content: | --- inputType: "CA10A1__CaAwsConnectInstance__c" importExtracts: - file: /types/CA10A1__CaAwsConnectInstance__c/object.extracts.yaml testData: - file: "test-data.json" conditions: - status: "INCOMPLIANT" currentStateMessage: "Connect instance flow logs are not enabled." remediationMessage: "Enable CloudWatch logging for the Connect instance to capture contact flow logs." check: CONTAINS: arg: EXTRACT: "caSetFrom__attributes__c" search: TEXT: "CONTACTFLOW_LOGS - false" - status: "COMPLIANT" currentStateMessage: "Connect instance flow logs are enabled." check: CONTAINS: arg: EXTRACT: "caSetFrom__attributes__c" search: TEXT: "CONTACTFLOW_LOGS - true" otherwise: status: "UNDETERMINED" currentStateMessage: "Unable to determine the Connect instance flow logs status." - path: /ce/ca/aws/connect/instance-flow-logs/test-data.json md5Hash: EDA012464227946E62C455AADE2C3876 content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10A1__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-07-09T03:22:15Z" }, "Id": "test1", "CA10A1__disappearanceTime__c": "2025-07-01T22:28:38Z", "CA10A1__attributes__c": "AUTOMATED_INTERACTION_LOG - false\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - false\nCONTACTFLOW_LOGS - false\nCONTACT_LENS - true\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - false\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - false" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - false')", "runtimeError": null }, "context": { "snapshotTime": "2025-07-09T03:22:15Z" }, "Id": "test2", "CA10A1__disappearanceTime__c": null, "CA10A1__attributes__c": "AUTOMATED_INTERACTION_LOG - false\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - false\nCONTACTFLOW_LOGS - false\nCONTACT_LENS - true\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - false\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - false" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "299", "conditionText": "extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - true')", "runtimeError": null }, "context": { "snapshotTime": "2025-07-09T03:22:15Z" }, "Id": "test3", "CA10A1__disappearanceTime__c": null, "CA10A1__attributes__c": "AUTOMATED_INTERACTION_LOG - true\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - true\nCONTACTFLOW_LOGS - true\nCONTACT_LENS - false\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - true\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - true" }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "300", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-07-09T03:22:15Z" }, "Id": "test4", "CA10A1__disappearanceTime__c": null, "CA10A1__attributes__c": "AUTOMATED_INTERACTION_LOG - true\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - true\nCONTACT_LENS - false\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - true\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - true" } ] - path: /types/CA10A1__CaAwsConnectInstance__c/object.extracts.yaml md5Hash: CE48A6A20DE05CD58C2DEF57B854CECE content: "---\nextracts:\n# Values in the form of 'ATTRIBUTE - boolean\\n': \n\ # INBOUND_CALLS | OUTBOUND_CALLS | CONTACTFLOW_LOGS | CONTACT_LENS \n# AUTO_RESOLVE_BEST_VOICES\ \ | USE_CUSTOM_TTS_VOICES | EARLY_MEDIA | MULTI_PARTY_CONFERENCE \n# HIGH_VOLUME_OUTBOUND\ \ | ENHANCED_CONTACT_MONITORING | ENHANCED_CHAT_MONITORING \n# MULTI_PARTY_CHAT_CONFERENCE\n\ # Not Nullable. \n - name: CA10A1__attributes__c\n value: \n FIELD:\n\ \ path: CA10A1__attributes__c\n undeterminedIf:\n noAccessDelegate:\n\ \ path: \"CA10A1__attributes__c\"\n currentStateMessage:\ \ \"AWS Connect Instance Attributes cannot be empty. Possible permissions issue\ \ with connect:ListInstanceAttributes\"\n - name: caSetFrom__attributes__c\n\ \ value: \n SET_FROM:\n separator: \"\\n\"\n arg:\n \ \ EXTRACT: \"CA10A1__attributes__c\"" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10A1__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - false')", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - true')", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "300", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10A1__CaAwsConnectInstance__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-07-09T03:22:15Z") }, "CA10A1__disappearanceTime__c" : new Date("2025-07-01T22:28:38Z"), "CA10A1__attributes__c" : "AUTOMATED_INTERACTION_LOG - false\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - false\nCONTACTFLOW_LOGS - false\nCONTACT_LENS - true\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - false\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - false", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-07-09T03:22:15Z") }, "CA10A1__attributes__c" : "AUTOMATED_INTERACTION_LOG - false\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - false\nCONTACTFLOW_LOGS - false\nCONTACT_LENS - true\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - false\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - false", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-07-09T03:22:15Z") }, "CA10A1__attributes__c" : "AUTOMATED_INTERACTION_LOG - true\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - true\nCONTACTFLOW_LOGS - true\nCONTACT_LENS - false\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - true\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - true", "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2025-07-09T03:22:15Z") }, "CA10A1__attributes__c" : "AUTOMATED_INTERACTION_LOG - true\nAUTO_RESOLVE_BEST_VOICES - true\nBOT_MANAGEMENT - true\nCONTACT_LENS - false\nEARLY_MEDIA - true\nENABLE_BOT_ANALYTICS_AND_TRANSCRIPTS - true\nENHANCED_CHAT_MONITORING - true\nENHANCED_CONTACT_MONITORING - true\nFORECASTING_PLANNING_SCHEDULING - true", "Id" : "test4" } ]; """; CREATE TEMP FUNCTION process_CA10A1__CaAwsConnectInstance__c( obj STRUCT< CA10A1__disappearanceTime__c TIMESTAMP, CA10A1__attributes__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var BytesLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg; }; 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 CollectionLib = new function () { this.parse = function(arg, separator, skipEmpty, skipDuplicates, sort, normalize) { if (arg == null) return []; let parts = arg.split(separator); return this.fromArray(parts, skipEmpty, skipDuplicates, sort, normalize); }; this.fromArray = function(arr, skipEmpty, skipDuplicates, sort, normalize) { if (arr == null) return []; let result = []; let seen = new Set(); arr.forEach(el => { let normalized = normalize ? TextLib.normalize(el) : BytesLib.normalize(el); if (!skipEmpty || (normalize ? TextLib.isNotEmpty(el) : BytesLib.isNotEmpty(el))) { if (!skipDuplicates || !seen.has(normalized)) { if (skipDuplicates) seen.add(normalized); result.push(normalized); } } }); if (sort) result.sort(); return result; }; this.equal = function(left, right) { left = left == null ? [] : left; right = right == null ? [] : right; if (left.length !== right.length) return false; for (let i = 0; i < left.length; i++) { if (left[i] !== right[i]) return false; } return true; }; this.notEqual = function(left, right) { return !this.equal(left, right); }; this.size = function(collection) { return collection == null ? 0 : collection.length; }; this.startsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[0] === normalizedSearch; }; this.endsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[collection.length - 1] === normalizedSearch; }; this.contains = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; return collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)); }; this.containsAll = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.every(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; this.containsAny = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.some(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; }(); 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 [CA10A1__disappearanceTime__c]: ' + obj.CA10A1__disappearanceTime__c); if (obj.CA10A1__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10A1__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function fieldChecked6() { if (TextLib.isEmpty(obj.CA10A1__attributes__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10A1__attributes__c.delegatedTo(CA10A1__attributes__c).isEmpty()", currentStateMessage: "AWS Connect Instance Attributes cannot be empty. Possible permissions issue with connect:ListInstanceAttributes", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10A1__attributes__c; } function extract5() { if (!this.out) { this.out = fieldChecked6(); } return this.out; }; function extract3() { if (!this.out) { this.out = CollectionLib.parse(extract5.call(extract5), '\n', true, true, true, true); } return this.out; }; references1.push('Attributes [obj.CA10A1__attributes__c]: ' + obj.CA10A1__attributes__c); try { if (CollectionLib.contains(extract3.call(extract3), 'CONTACTFLOW_LOGS - false', true)) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - false')", currentStateMessage: "Connect instance flow logs are not enabled.", currentStateReferences: references1.join('\n'), remediation: "Enable CloudWatch logging for the Connect instance to capture contact flow logs.", runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function fieldChecked12() { if (TextLib.isEmpty(obj.CA10A1__attributes__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10A1__attributes__c.delegatedTo(CA10A1__attributes__c).isEmpty()", currentStateMessage: "AWS Connect Instance Attributes cannot be empty. Possible permissions issue with connect:ListInstanceAttributes", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10A1__attributes__c; } function extract11() { if (!this.out) { this.out = fieldChecked12(); } return this.out; }; function extract9() { if (!this.out) { this.out = CollectionLib.parse(extract11.call(extract11), '\n', true, true, true, true); } return this.out; }; try { if (CollectionLib.contains(extract9.call(extract9), 'CONTACTFLOW_LOGS - true', true)) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "extract('caSetFrom__attributes__c').contains('CONTACTFLOW_LOGS - true')", currentStateMessage: "Connect instance flow logs are enabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } return {status: 'UNDETERMINED', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "Unable to determine the Connect instance flow logs status.", 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.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__attributes__c AS CA10A1__attributes__c, sObject.Id AS Id, process_CA10A1__CaAwsConnectInstance__c( STRUCT( sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__attributes__c AS CA10A1__attributes__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10A1__CaAwsConnectInstance__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;