--- policy: /ce/ca/aws/vpc/no-ec2-vpc-endpoint logic: /ce/ca/aws/vpc/no-ec2-vpc-endpoint/prod.logic.yaml executionTime: 2026-06-06T12:03:28.827287496Z generationMs: 72 executionMs: 1383 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_Instances__r.hasNo(COMPLIANT) actual: CA10__AWS_EC2_Instances__r.hasNo(COMPLIANT) runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__AWS_VPC_Endpoints__r.has(COMPLIANT) actual: CA10__AWS_VPC_Endpoints__r.has(COMPLIANT) runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test5 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/aws/vpc/no-ec2-vpc-endpoint/policy.yaml md5Hash: ED2535C5D59E1A141B86985F181468FE content: "---\nnames:\n full: AWS VPC is not configured with a VPC Endpoint for\ \ Amazon EC2 service\n contextual: VPC is not configured with a VPC Endpoint\ \ for Amazon EC2 service\ndescription: >\n Ensures that Amazon VPCs have a\ \ VPC Endpoint configured for the EC2 service to \n establish private connection\ \ between your VPC and an AWS service using a network interface.\ntype: COMPLIANCE_POLICY\n\ categories:\n - SECURITY\nframeworkMappings:\n - \"/frameworks/cloudaware/resource-security/secure-access\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/ec2/10\"\nsimilarPolicies:\n awsSecurityHub:\n\ \ - name: \"[EC2.10] Amazon EC2 should be configured to use VPC endpoints\ \ that are created for the Amazon EC2 service\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-10\"\ \n" - path: /ce/ca/aws/vpc/no-ec2-vpc-endpoint/prod.logic.yaml md5Hash: 7F44FE04BFD8E7B73AE8920020E8328D content: | inputType: "CA10__CaAwsVpc__c" testData: - file: "test-data.json" conditions: - status: "INAPPLICABLE" currentStateMessage: "This VPC does not have any EC2 instances." check: RELATED_LIST_HAS_NO: status: "COMPLIANT" relationshipName: "CA10__AWS_EC2_Instances__r" - status: "COMPLIANT" currentStateMessage: "The VPC has an active VPC endpoint for the EC2 service." check: RELATED_LIST_HAS: status: "COMPLIANT" relationshipName: "CA10__AWS_VPC_Endpoints__r" otherwise: status: "INCOMPLIANT" currentStateMessage: "The VPC does not have an active VPC endpoint for the EC2 service." remediationMessage: "Create a VPC endpoint for the Amazon EC2 service so traffic between the VPC and EC2 stays on the Amazon network." relatedLists: - relationshipName: "CA10__AWS_EC2_Instances__r" conditions: [] otherwise: status: "COMPLIANT" currentStateMessage: "This is an EC2 instance." - relationshipName: "CA10__AWS_VPC_Endpoints__r" importExtracts: - file: /types/CA10__CaAwsVpcEndpoint__c/object.extracts.yaml conditions: - status: "COMPLIANT" currentStateMessage: "This is an active VPC endpoint for the EC2 service." check: AND: args: - IS_EQUAL: left: EXTRACT: "CA10__endpointServiceId__c" right: TEXT: "ec2" - IS_EQUAL: left: EXTRACT: "CA10__state__c" right: TEXT: "available" otherwise: status: "INAPPLICABLE" currentStateMessage: "This is not an active VPC endpoint for the EC2 service." - path: /ce/ca/aws/vpc/no-ec2-vpc-endpoint/test-data.json md5Hash: 7BFBC58DDAD61586C6E411FEBA00A2BC content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-08-28T09:23:53Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2025-08-19T22:13:08Z", "CA10__AWS_EC2_Instances__r": [], "CA10__AWS_VPC_Endpoints__r": [ { "Id": "test1_1", "CA10__disappearanceTime__c": "2025-08-19T22:34:31Z", "CA10__endpointServiceId__c": "dynamodb", "CA10__state__c": "available", "CA10__vpc__c": "test1" } ] }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "CA10__AWS_EC2_Instances__r.hasNo(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-08-28T09:23:53Z" }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__AWS_EC2_Instances__r": [], "CA10__AWS_VPC_Endpoints__r": [ { "Id": "test2_1", "CA10__disappearanceTime__c": null, "CA10__endpointServiceId__c": "ec2", "CA10__state__c": "available", "CA10__vpc__c": "test2" } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "299", "conditionText": "CA10__AWS_VPC_Endpoints__r.has(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-08-28T09:23:53Z" }, "Id": "test3", "CA10__disappearanceTime__c": null, "CA10__AWS_EC2_Instances__r": [ { "Id": "test3_1", "CA10__disappearanceTime__c": null, "CA10__vpc__c": "test3" } ], "CA10__AWS_VPC_Endpoints__r": [ { "Id": "test3_2", "CA10__disappearanceTime__c": null, "CA10__endpointServiceId__c": "ec2", "CA10__state__c": "available", "CA10__vpc__c": "test3" } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "300", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-08-28T09:23:53Z" }, "Id": "test4", "CA10__disappearanceTime__c": null, "CA10__AWS_EC2_Instances__r": [ { "Id": "test4_1", "CA10__disappearanceTime__c": null, "CA10__vpc__c": "test4" } ], "CA10__AWS_VPC_Endpoints__r": [ { "Id": "test4_2", "CA10__disappearanceTime__c": null, "CA10__endpointServiceId__c": "s3", "CA10__state__c": "available", "CA10__vpc__c": "test4" } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "300", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-08-28T09:23:53Z" }, "Id": "test5", "CA10__disappearanceTime__c": null, "CA10__AWS_EC2_Instances__r": [ { "Id": "test5_1", "CA10__disappearanceTime__c": null, "CA10__vpc__c": "test5" } ], "CA10__AWS_VPC_Endpoints__r": [ { "Id": "test5_2", "CA10__disappearanceTime__c": "2025-08-28T09:23:53Z", "CA10__endpointServiceId__c": "s3", "CA10__state__c": "available", "CA10__vpc__c": "test5" } ] } ] - path: /types/CA10__CaAwsVpcEndpoint__c/object.extracts.yaml md5Hash: A6696F89483514817E2BC1EB05B183F6 content: "---\nextracts:\n# Not Nullable. Can't have no access, retrieved via\ \ ec2:DescribeVpcEndpoints\n - name: CA10__endpointServiceId__c\n value:\n\ \ FIELD: \n path: CA10__endpointServiceId__c\n undeterminedIf:\n\ \ isEmpty: \"Corrupted data. Endpoint Service ID cannot be empty.\"\ \ \n# Values: PendingAcceptance | Pending | Available | Deleting | Deleted |\ \ Rejected | Failed | Expired | Partial\n# Not Nullable. Can't have no access,\ \ retrieved via ec2:DescribeVpcEndpoints\n - name: CA10__state__c\n value:\n\ \ FIELD: \n path: CA10__state__c\n undeterminedIf:\n \ \ isEmpty: \"Corrupted data. Endpoint state cannot be empty.\" \n" 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_Instances__r.hasNo(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "299", "conditionText" : "CA10__AWS_VPC_Endpoints__r.has(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "300", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "300", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsVpc__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__disappearanceTime__c" : new Date("2025-08-19T22:13:08Z"), "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "Id" : "test5" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsInstance__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__vpc__c" : "test3", "Id" : "test3_1" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__vpc__c" : "test4", "Id" : "test4_1" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__vpc__c" : "test5", "Id" : "test5_1" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsVpcEndpoint__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__disappearanceTime__c" : new Date("2025-08-19T22:34:31Z"), "CA10__endpointServiceId__c" : "dynamodb", "CA10__state__c" : "available", "CA10__vpc__c" : "test1", "Id" : "test1_1" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__endpointServiceId__c" : "ec2", "CA10__state__c" : "available", "CA10__vpc__c" : "test2", "Id" : "test2_1" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__endpointServiceId__c" : "ec2", "CA10__state__c" : "available", "CA10__vpc__c" : "test3", "Id" : "test3_2" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__endpointServiceId__c" : "s3", "CA10__state__c" : "available", "CA10__vpc__c" : "test4", "Id" : "test4_2" }, { "context" : { "snapshotTime" : new Date("2025-08-28T09:23:53Z") }, "CA10__disappearanceTime__c" : new Date("2025-08-28T09:23:53Z"), "CA10__endpointServiceId__c" : "s3", "CA10__state__c" : "available", "CA10__vpc__c" : "test5", "Id" : "test5_2" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsVpc__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__AWS_EC2_Instances__r ARRAY >>, CA10__AWS_VPC_Endpoints__r ARRAY >>, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" 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_Instances__r_COMPLIANT2 = 0; if (obj.CA10__AWS_EC2_Instances__r != null) { for (var i3 = 0; i3 < obj.CA10__AWS_EC2_Instances__r.length; i3++) { if (typeof(obj.CA10__AWS_EC2_Instances__r[i3].status) !== 'undefined') { if (obj.CA10__AWS_EC2_Instances__r[i3].status == 'COMPLIANT') { count_CA10__AWS_EC2_Instances__r_COMPLIANT2 += obj.CA10__AWS_EC2_Instances__r[i3].count; } } else { if (obj.CA10__AWS_EC2_Instances__r[i3].result.status == 'COMPLIANT') { count_CA10__AWS_EC2_Instances__r_COMPLIANT2 += 1; } } } } // condition[1], conditionIndex:[100..199] references1.push('Related list [CA10__AWS_EC2_Instances__r] ' + (count_CA10__AWS_EC2_Instances__r_COMPLIANT2 == 0 ? 'does not have' : 'has') + ' objects in COMPLIANT status'); if (count_CA10__AWS_EC2_Instances__r_COMPLIANT2 == 0) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "CA10__AWS_EC2_Instances__r.hasNo(COMPLIANT)", currentStateMessage: "This VPC does not have any EC2 instances.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10__AWS_VPC_Endpoints__r_COMPLIANT4 = 0; if (obj.CA10__AWS_VPC_Endpoints__r != null) { for (var i5 = 0; i5 < obj.CA10__AWS_VPC_Endpoints__r.length; i5++) { if (typeof(obj.CA10__AWS_VPC_Endpoints__r[i5].status) !== 'undefined') { if (obj.CA10__AWS_VPC_Endpoints__r[i5].status == 'COMPLIANT') { count_CA10__AWS_VPC_Endpoints__r_COMPLIANT4 += obj.CA10__AWS_VPC_Endpoints__r[i5].count; } } else { if (obj.CA10__AWS_VPC_Endpoints__r[i5].result.status == 'COMPLIANT') { count_CA10__AWS_VPC_Endpoints__r_COMPLIANT4 += 1; } } } } // condition[2], conditionIndex:[200..299] references1.push('Related list [CA10__AWS_VPC_Endpoints__r] ' + (count_CA10__AWS_VPC_Endpoints__r_COMPLIANT4 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status'); if (count_CA10__AWS_VPC_Endpoints__r_COMPLIANT4 > 0) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "CA10__AWS_VPC_Endpoints__r.has(COMPLIANT)", currentStateMessage: "The VPC has an active VPC endpoint for the EC2 service.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INCOMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "The VPC does not have an active VPC endpoint for the EC2 service.", currentStateReferences: references1.join('\n'), remediation: "Create a VPC endpoint for the Amazon EC2 service so traffic between the VPC and EC2 stays on the Amazon network.", runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__AWS_EC2_Instances__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__vpc__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" 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}; } return {status: 'COMPLIANT', conditionIndex: 100, conditionText: "otherwise", currentStateMessage: "This is an EC2 instance.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__AWS_VPC_Endpoints__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__endpointServiceId__c STRING, CA10__state__c STRING, CA10__vpc__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__endpointServiceId__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__endpointServiceId__c.isEmpty()", currentStateMessage: "Corrupted data. Endpoint Service ID cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__endpointServiceId__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; function fieldChecked7() { if (TextLib.isEmpty(obj.CA10__state__c)) { throw new Error("UNDETERMINED condition:102", {cause: {status: 'UNDETERMINED', conditionIndex: 102, conditionText: "CA10__state__c.isEmpty()", currentStateMessage: "Corrupted data. Endpoint state cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__state__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; references1.push('Endpoint Service ID [obj.CA10__endpointServiceId__c]: ' + obj.CA10__endpointServiceId__c); references1.push('State [obj.CA10__state__c]: ' + obj.CA10__state__c); try { if (TextLib.equal(extract3.call(extract3), 'ec2') && TextLib.equal(extract6.call(extract6), 'available')) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__endpointServiceId__c') == 'ec2' && extract('CA10__state__c') == 'available'", currentStateMessage: "This is an active VPC endpoint for the EC2 service.", 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: 200, conditionText: "otherwise", currentStateMessage: "This is not an active VPC endpoint for the EC2 service.", 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, `CA10__AWS_EC2_Instances__r`.arr AS CA10__AWS_EC2_Instances__r, `CA10__AWS_VPC_Endpoints__r`.arr AS CA10__AWS_VPC_Endpoints__r, sObject.Id AS Id, process_CA10__CaAwsVpc__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, `CA10__AWS_EC2_Instances__r`.arr AS CA10__AWS_EC2_Instances__r, `CA10__AWS_VPC_Endpoints__r`.arr AS CA10__AWS_VPC_Endpoints__r, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsVpc__c()) AS sObject LEFT JOIN ( SELECT sObject.CA10__vpc__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__vpc__c AS CA10__vpc__c, sObject.Id AS Id, process_CA10__AWS_EC2_Instances__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__vpc__c AS CA10__vpc__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsInstance__c()) AS sObject GROUP BY sObject.CA10__vpc__c ) AS `CA10__AWS_EC2_Instances__r` ON sObject.Id = `CA10__AWS_EC2_Instances__r`.CA10__vpc__c LEFT JOIN ( SELECT sObject.CA10__vpc__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__endpointServiceId__c AS CA10__endpointServiceId__c, sObject.CA10__state__c AS CA10__state__c, sObject.CA10__vpc__c AS CA10__vpc__c, sObject.Id AS Id, process_CA10__AWS_VPC_Endpoints__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__endpointServiceId__c AS CA10__endpointServiceId__c, sObject.CA10__state__c AS CA10__state__c, sObject.CA10__vpc__c AS CA10__vpc__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsVpcEndpoint__c()) AS sObject GROUP BY sObject.CA10__vpc__c ) AS `CA10__AWS_VPC_Endpoints__r` ON sObject.Id = `CA10__AWS_VPC_Endpoints__r`.CA10__vpc__c ) sObject ON sObject.Id = expectedResult.Id;