--- policy: /ce/ca/automated-provisioning/aws-ebs-snapshot logic: /ce/ca/automated-provisioning/aws-ebs-snapshot/prod.logic.yaml executionTime: 2026-09-22T15:05:14.416919792Z generationMs: 78 executionMs: 1134 rows: - id: test-aws-backup-source-resource match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:backup:source-resource')) actual: CA10__tagsJson__c.hasExact(bytes('aws:backup:source-resource')) runtimeError: {} - id: test-aws-application-migration-service-managed match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__tagsJson__c.getExact(bytes('AWSApplicationMigrationServiceManaged')) == 'mgn.amazonaws.com' actual: CA10__tagsJson__c.getExact(bytes('AWSApplicationMigrationServiceManaged')) == 'mgn.amazonaws.com' runtimeError: {} - id: test-aws-elastic-disaster-recovery-managed match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com' actual: CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com' runtimeError: {} - id: test-aws-dlm-snapshot-tags match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-policy-id')) && CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-schedule-name')) && CA10__tagsJson__c.hasExact(bytes('dlm:managed')) actual: CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-policy-id')) && CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-schedule-name')) && CA10__tagsJson__c.hasExact(bytes('dlm:managed')) runtimeError: {} - id: test-no-automated-provisioning-tags match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-aws-backup-managed-resource-not-supported match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-aws-application-migration-service-wrong-value match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-aws-dlm-incomplete-tags match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/automated-provisioning/aws-ebs-snapshot/policy.yaml md5Hash: E16B697D0E95E8DDCEA97B8965EE01AE content: "---\nnames:\n full: \"AWS EBS Snapshot auto-provisioning status\"\n\ \ contextual: \"EBS Snapshot auto-provisioning status\"\ndescription: >\n \ \ Identify AWS EBS Snapshots with AWS-managed tag evidence that may \n indicate\ \ creation or management by AWS Backup, Amazon Data Lifecycle Manager, \n AWS\ \ Application Migration Service, or AWS Elastic Disaster Recovery.\"\ntype:\ \ COMPLIANCE_POLICY\ncategories:\n - RELIABILITY\n" - path: /ce/ca/automated-provisioning/aws-ebs-snapshot/prod.logic.yaml md5Hash: 9547B8D9A36C7D44566B4E7729417C3F content: | --- inputType: "CA10__CaAwsSnapshot__c" testData: - file: "test-data.json" conditions: - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Backup." check: TAG_EXISTS: name: BYTES: "aws:backup:source-resource" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Application Migration Service." check: IS_EQUAL: left: TAG_VALUE_TEXT: name: BYTES: "AWSApplicationMigrationServiceManaged" right: TEXT: "mgn.amazonaws.com" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Elastic Disaster Recovery." check: IS_EQUAL: left: TAG_VALUE_TEXT: name: BYTES: "AWSElasticDisasterRecoveryManaged" right: TEXT: "drs.amazonaws.com" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is Amazon Data Lifecycle Manager." check: AND: args: - TAG_EXISTS: name: BYTES: "aws:dlm:lifecycle-policy-id" - TAG_EXISTS: name: BYTES: "aws:dlm:lifecycle-schedule-name" - TAG_EXISTS: name: BYTES: "dlm:managed" otherwise: status: "INCOMPLIANT" currentStateMessage: "The automated provisioning source is not identified by supported AWS-managed tag signals." remediationMessage: "Review the automated provisioning source, ownership, and expected management workflow." - path: /ce/ca/automated-provisioning/aws-ebs-snapshot/test-data.json md5Hash: EFFED9ABEFA109CCD55ED82A19EDD0F4 content: | [ { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "199", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:backup:source-resource'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-backup-source-resource", "Name": "test-aws-backup-source-resource", "CA10__tagsJson__c": "{\"aws:backup:source-resource\":\"arn:aws:ec2:us-east-1:123456789012:volume/vol-0123456789abcdef0\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "299", "conditionText": "CA10__tagsJson__c.getExact(bytes('AWSApplicationMigrationServiceManaged')) == 'mgn.amazonaws.com'", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-application-migration-service-managed", "Name": "test-aws-application-migration-service-managed", "CA10__tagsJson__c": "{\"AWSApplicationMigrationServiceManaged\":\"mgn.amazonaws.com\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "399", "conditionText": "CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com'", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-elastic-disaster-recovery-managed", "Name": "test-aws-elastic-disaster-recovery-managed", "CA10__tagsJson__c": "{\"AWSElasticDisasterRecoveryManaged\":\"drs.amazonaws.com\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "499", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-policy-id')) && CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-schedule-name')) && CA10__tagsJson__c.hasExact(bytes('dlm:managed'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-dlm-snapshot-tags", "Name": "test-aws-dlm-snapshot-tags", "CA10__tagsJson__c": "{\"aws:dlm:lifecycle-policy-id\":\"policy-0123456789abcdef0\",\"aws:dlm:lifecycle-schedule-name\":\"Daily backups\",\"dlm:managed\":\"true\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-no-automated-provisioning-tags", "Name": "test-no-automated-provisioning-tags", "CA10__tagsJson__c": "{\"Owner\":\"platform-team\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-backup-managed-resource-not-supported", "Name": "test-aws-backup-managed-resource-not-supported", "CA10__tagsJson__c": "{\"AWSBackupManagedResource\":\"2026-06-23T00:00:00Z\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-application-migration-service-wrong-value", "Name": "test-aws-application-migration-service-wrong-value", "CA10__tagsJson__c": "{\"AWSApplicationMigrationServiceManaged\":\"true\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-dlm-incomplete-tags", "Name": "test-aws-dlm-incomplete-tags", "CA10__tagsJson__c": "{\"aws:dlm:lifecycle-policy-id\":\"policy-0123456789abcdef0\",\"aws:dlm:lifecycle-schedule-name\":\"Daily backups\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } } ] script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test-aws-backup-source-resource", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "199", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:backup:source-resource'))", "runtimeError" : null } }, { "Id" : "test-aws-application-migration-service-managed", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "299", "conditionText" : "CA10__tagsJson__c.getExact(bytes('AWSApplicationMigrationServiceManaged')) == 'mgn.amazonaws.com'", "runtimeError" : null } }, { "Id" : "test-aws-elastic-disaster-recovery-managed", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "399", "conditionText" : "CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com'", "runtimeError" : null } }, { "Id" : "test-aws-dlm-snapshot-tags", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "499", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-policy-id')) && CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-schedule-name')) && CA10__tagsJson__c.hasExact(bytes('dlm:managed'))", "runtimeError" : null } }, { "Id" : "test-no-automated-provisioning-tags", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-aws-backup-managed-resource-not-supported", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-aws-application-migration-service-wrong-value", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-aws-dlm-incomplete-tags", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsSnapshot__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:backup:source-resource\":\"arn:aws:ec2:us-east-1:123456789012:volume/vol-0123456789abcdef0\"}", "Id" : "test-aws-backup-source-resource" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"AWSApplicationMigrationServiceManaged\":\"mgn.amazonaws.com\"}", "Id" : "test-aws-application-migration-service-managed" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"AWSElasticDisasterRecoveryManaged\":\"drs.amazonaws.com\"}", "Id" : "test-aws-elastic-disaster-recovery-managed" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:dlm:lifecycle-policy-id\":\"policy-0123456789abcdef0\",\"aws:dlm:lifecycle-schedule-name\":\"Daily backups\",\"dlm:managed\":\"true\"}", "Id" : "test-aws-dlm-snapshot-tags" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"Owner\":\"platform-team\"}", "Id" : "test-no-automated-provisioning-tags" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"AWSBackupManagedResource\":\"2026-06-23T00:00:00Z\"}", "Id" : "test-aws-backup-managed-resource-not-supported" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"AWSApplicationMigrationServiceManaged\":\"true\"}", "Id" : "test-aws-application-migration-service-wrong-value" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:dlm:lifecycle-policy-id\":\"policy-0123456789abcdef0\",\"aws:dlm:lifecycle-schedule-name\":\"Daily backups\"}", "Id" : "test-aws-dlm-incomplete-tags" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsSnapshot__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__tagsJson__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var TagsLib = new function () { this.inexact = function(tag) { return tag == null ? null : tag.replace(/[^a-zA-Z0-9]/g, '').toLowerCase(); } this.parseTags = function(tagsJson) { if (tagsJson && tagsJson !== '') { return JSON.parse(tagsJson); } else { return {}; } } this.tagExists = function(tagName, exact, tagsJson) { var checkTag = exact ? tagName : this.inexact(tagName); var parsed = this.parseTags(tagsJson); var exists = false; for (var parsedTagName in parsed) { var currentTagName = exact ? parsedTagName : this.inexact(parsedTagName); if (currentTagName === checkTag) { exists = true; break; } } return exists; } this.tagValue = function(tagName, exact, tagsJson) { var checkTag = exact ? tagName : this.inexact(tagName); var parsed = this.parseTags(tagsJson); var value = ''; for (var parsedTagName in parsed) { var currentTagName = exact ? parsedTagName : this.inexact(parsedTagName); if (currentTagName === checkTag) { value = parsed[parsedTagName]; break; } } return value; } }(); 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] references1.push('Tags JSON [obj.CA10__tagsJson__c]: ' + obj.CA10__tagsJson__c); if (TagsLib.tagExists('aws:backup:source-resource', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:backup:source-resource'))", currentStateMessage: "The automated provisioning source is AWS Backup.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] if (TextLib.equal(TagsLib.tagValue('AWSApplicationMigrationServiceManaged', true, obj.CA10__tagsJson__c), 'mgn.amazonaws.com')) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "CA10__tagsJson__c.getExact(bytes('AWSApplicationMigrationServiceManaged')) == 'mgn.amazonaws.com'", currentStateMessage: "The automated provisioning source is AWS Application Migration Service.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[3], conditionIndex:[300..399] if (TextLib.equal(TagsLib.tagValue('AWSElasticDisasterRecoveryManaged', true, obj.CA10__tagsJson__c), 'drs.amazonaws.com')) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com'", currentStateMessage: "The automated provisioning source is AWS Elastic Disaster Recovery.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[4], conditionIndex:[400..499] if (TagsLib.tagExists('aws:dlm:lifecycle-policy-id', true, obj.CA10__tagsJson__c) && TagsLib.tagExists('aws:dlm:lifecycle-schedule-name', true, obj.CA10__tagsJson__c) && TagsLib.tagExists('dlm:managed', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-policy-id')) && CA10__tagsJson__c.hasExact(bytes('aws:dlm:lifecycle-schedule-name')) && CA10__tagsJson__c.hasExact(bytes('dlm:managed'))", currentStateMessage: "The automated provisioning source is Amazon Data Lifecycle Manager.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INCOMPLIANT', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "The automated provisioning source is not identified by supported AWS-managed tag signals.", currentStateReferences: references1.join('\n'), remediation: "Review the automated provisioning source, ownership, and expected management workflow.", 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__tagsJson__c AS CA10__tagsJson__c, sObject.Id AS Id, process_CA10__CaAwsSnapshot__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__tagsJson__c AS CA10__tagsJson__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsSnapshot__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;