--- policy: /ce/ca/automated-provisioning/aws-ec2-instance logic: /ce/ca/automated-provisioning/aws-ec2-instance/prod.logic.yaml executionTime: 2026-09-22T15:05:15.671324569Z generationMs: 86 executionMs: 1128 rows: - id: test-disappeared-ec2-instance 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: test-aws-cloudformation-logical-id match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:logical-id')) actual: CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:logical-id')) runtimeError: {} - id: test-aws-cloudformation-stack-id match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-id')) actual: CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-id')) runtimeError: {} - id: test-aws-cloudformation-stack-name match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-name')) actual: CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-name')) runtimeError: {} - id: test-aws-autoscaling-group-name match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:autoscaling:groupName')) actual: CA10__tagsJson__c.hasExact(bytes('aws:autoscaling:groupName')) runtimeError: {} - id: test-emr-system-tags match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 599 actual: 599 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:job-flow-id')) && CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:instance-group-role')) actual: CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:job-flow-id')) && CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:instance-group-role')) runtimeError: {} - id: test-eks-managed-node-group-tags match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 699 actual: 699 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('eks:cluster-name')) && CA10__tagsJson__c.hasExact(bytes('eks:nodegroup-name')) actual: CA10__tagsJson__c.hasExact(bytes('eks:cluster-name')) && CA10__tagsJson__c.hasExact(bytes('eks:nodegroup-name')) runtimeError: {} - id: test-aws-servicecatalog-portfolioarn match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 799 actual: 799 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:portfolioArn')) actual: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:portfolioArn')) runtimeError: {} - id: test-aws-servicecatalog-productarn match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 899 actual: 899 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:productArn')) actual: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:productArn')) runtimeError: {} - id: test-aws-servicecatalog-provisioningprincipalarn match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 999 actual: 999 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningPrincipalArn')) actual: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningPrincipalArn')) runtimeError: {} - id: test-aws-servicecatalog-provisionedproductarn match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 1099 actual: 1099 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisionedProductArn')) actual: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisionedProductArn')) runtimeError: {} - id: test-aws-servicecatalog-provisioningartifactidentifier match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 1199 actual: 1199 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningArtifactIdentifier')) actual: CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningArtifactIdentifier')) runtimeError: {} - id: test-aws-application-migration-service-managed match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 1299 actual: 1299 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: 1399 actual: 1399 conditionText: expected: CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com' actual: CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com' runtimeError: {} - id: test-elasticbeanstalk-environment-tags match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 1499 actual: 1499 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-name')) && CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-id')) actual: CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-name')) && CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-id')) runtimeError: {} - id: test-emr-single-tag-not-enough match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-eks-single-tag-not-enough match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-elasticbeanstalk-single-tag-not-enough match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-mgn-unexpected-value-not-enough match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-aws-eks-cost-tag-not-standalone-evidence match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-launch-template-system-tags match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 1599 actual: 1599 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:id')) && CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:version')) actual: CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:id')) && CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:version')) runtimeError: {} - id: test-ec2-fleet-tag match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 1699 actual: 1699 conditionText: expected: CA10__tagsJson__c.hasExact(bytes('aws:ec2:fleet-id')) actual: CA10__tagsJson__c.hasExact(bytes('aws:ec2:fleet-id')) runtimeError: {} - id: test-aws-batch-tag-not-standalone-evidence match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-cloud9-system-tags-not-standalone-evidence match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test-no-supported-provisioning-tags match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1700 actual: 1700 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/automated-provisioning/aws-ec2-instance/policy.yaml md5Hash: 816BE6DBECAB66E2AB42794245CC35BD content: | --- names: full: "AWS EC2 Instance auto-provisioning status" contextual: "EC2 Instance auto-provisioning status" description: "Identify AWS EC2 Instances that appear to be associated with AWS-managed\ \ provisioning or management workflows based on supported AWS-managed tag signals." type: COMPLIANCE_POLICY categories: - RELIABILITY - path: /ce/ca/automated-provisioning/aws-ec2-instance/prod.logic.yaml md5Hash: 1A90FC29B7BABCBAC32FBE44AFC7D257 content: | --- inputType: "CA10__CaAwsInstance__c" testData: - file: "test-data.json" conditions: - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS CloudFormation." check: TAG_EXISTS: name: BYTES: "aws:cloudformation:logical-id" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS CloudFormation." check: TAG_EXISTS: name: BYTES: "aws:cloudformation:stack-id" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS CloudFormation." check: TAG_EXISTS: name: BYTES: "aws:cloudformation:stack-name" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is Amazon EC2 Auto Scaling." check: TAG_EXISTS: name: BYTES: "aws:autoscaling:groupName" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is Amazon EMR." check: AND: args: - TAG_EXISTS: name: BYTES: "aws:elasticmapreduce:job-flow-id" - TAG_EXISTS: name: BYTES: "aws:elasticmapreduce:instance-group-role" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is Amazon EKS." check: AND: args: - TAG_EXISTS: name: BYTES: "eks:cluster-name" - TAG_EXISTS: name: BYTES: "eks:nodegroup-name" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Service Catalog." check: TAG_EXISTS: name: BYTES: "aws:servicecatalog:portfolioArn" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Service Catalog." check: TAG_EXISTS: name: BYTES: "aws:servicecatalog:productArn" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Service Catalog." check: TAG_EXISTS: name: BYTES: "aws:servicecatalog:provisioningPrincipalArn" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Service Catalog." check: TAG_EXISTS: name: BYTES: "aws:servicecatalog:provisionedProductArn" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is AWS Service Catalog." check: TAG_EXISTS: name: BYTES: "aws:servicecatalog:provisioningArtifactIdentifier" - 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 AWS Elastic Beanstalk." check: AND: args: - TAG_EXISTS: name: BYTES: "elasticbeanstalk:environment-name" - TAG_EXISTS: name: BYTES: "elasticbeanstalk:environment-id" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is Amazon EC2 launch template." check: AND: args: - TAG_EXISTS: name: BYTES: "aws:ec2launchtemplate:id" - TAG_EXISTS: name: BYTES: "aws:ec2launchtemplate:version" - status: "COMPLIANT" currentStateMessage: "The automated provisioning source is Amazon EC2 Fleet." check: TAG_EXISTS: name: BYTES: "aws:ec2:fleet-id" 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-ec2-instance/test-data.json md5Hash: 66610F57EADF027C67023D725CFDF7C2 content: | [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-disappeared-ec2-instance", "Name": "test-disappeared-ec2-instance", "CA10__tagsJson__c": "{\"Owner\":\"platform-team\"}", "CA10__disappearanceTime__c": "2026-06-22T00:00:00Z", "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "199", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:logical-id'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-cloudformation-logical-id", "Name": "test-aws-cloudformation-logical-id", "CA10__tagsJson__c": "{\"aws:cloudformation:logical-id\":\"Instance\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "299", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-id'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-cloudformation-stack-id", "Name": "test-aws-cloudformation-stack-id", "CA10__tagsJson__c": "{\"aws:cloudformation:stack-id\":\"arn:aws:cloudformation:us-east-1:123456789012:stack/test/test\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "399", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-name'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-cloudformation-stack-name", "Name": "test-aws-cloudformation-stack-name", "CA10__tagsJson__c": "{\"aws:cloudformation:stack-name\":\"test-stack\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "499", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:autoscaling:groupName'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-autoscaling-group-name", "Name": "test-aws-autoscaling-group-name", "CA10__tagsJson__c": "{\"aws:autoscaling:groupName\":\"test-asg\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "599", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:job-flow-id')) && CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:instance-group-role'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-emr-system-tags", "Name": "test-emr-system-tags", "CA10__tagsJson__c": "{\"aws:elasticmapreduce:job-flow-id\":\"j-12345678\",\"aws:elasticmapreduce:instance-group-role\":\"CORE\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "699", "conditionText": "CA10__tagsJson__c.hasExact(bytes('eks:cluster-name')) && CA10__tagsJson__c.hasExact(bytes('eks:nodegroup-name'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-eks-managed-node-group-tags", "Name": "test-eks-managed-node-group-tags", "CA10__tagsJson__c": "{\"eks:cluster-name\":\"test-cluster\",\"eks:nodegroup-name\":\"test-nodegroup\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "799", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:portfolioArn'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-servicecatalog-portfolioarn", "Name": "test-aws-servicecatalog-portfolioarn", "CA10__tagsJson__c": "{\"aws:servicecatalog:portfolioArn\":\"arn:aws:catalog:us-east-1:123456789012:portfolio/port-abc123\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "899", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:productArn'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-servicecatalog-productarn", "Name": "test-aws-servicecatalog-productarn", "CA10__tagsJson__c": "{\"aws:servicecatalog:productArn\":\"arn:aws:catalog:us-east-1:123456789012:product/prod-abc123\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "999", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningPrincipalArn'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-servicecatalog-provisioningprincipalarn", "Name": "test-aws-servicecatalog-provisioningprincipalarn", "CA10__tagsJson__c": "{\"aws:servicecatalog:provisioningPrincipalArn\":\"arn:aws:iam::123456789012:role/provisioning-role\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "1099", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisionedProductArn'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-servicecatalog-provisionedproductarn", "Name": "test-aws-servicecatalog-provisionedproductarn", "CA10__tagsJson__c": "{\"aws:servicecatalog:provisionedProductArn\":\"arn:aws:servicecatalog:us-east-1:123456789012:stack/test/pp-abc123\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "1199", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningArtifactIdentifier'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-servicecatalog-provisioningartifactidentifier", "Name": "test-aws-servicecatalog-provisioningartifactidentifier", "CA10__tagsJson__c": "{\"aws:servicecatalog:provisioningArtifactIdentifier\":\"pa-abc123\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "1299", "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": "1399", "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": "1499", "conditionText": "CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-name')) && CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-id'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-elasticbeanstalk-environment-tags", "Name": "test-elasticbeanstalk-environment-tags", "CA10__tagsJson__c": "{\"elasticbeanstalk:environment-name\":\"test-env\",\"elasticbeanstalk:environment-id\":\"e-abc123\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-emr-single-tag-not-enough", "Name": "test-emr-single-tag-not-enough", "CA10__tagsJson__c": "{\"aws:elasticmapreduce:job-flow-id\":\"j-12345678\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-eks-single-tag-not-enough", "Name": "test-eks-single-tag-not-enough", "CA10__tagsJson__c": "{\"eks:cluster-name\":\"test-cluster\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-elasticbeanstalk-single-tag-not-enough", "Name": "test-elasticbeanstalk-single-tag-not-enough", "CA10__tagsJson__c": "{\"elasticbeanstalk:environment-name\":\"test-env\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-mgn-unexpected-value-not-enough", "Name": "test-mgn-unexpected-value-not-enough", "CA10__tagsJson__c": "{\"AWSApplicationMigrationServiceManaged\":\"unexpected\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-eks-cost-tag-not-standalone-evidence", "Name": "test-aws-eks-cost-tag-not-standalone-evidence", "CA10__tagsJson__c": "{\"aws:eks:cluster-name\":\"test-cluster\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "1599", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:id')) && CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:version'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-launch-template-system-tags", "Name": "test-launch-template-system-tags", "CA10__tagsJson__c": "{\"aws:ec2launchtemplate:id\":\"lt-0123456789abcdef0\",\"aws:ec2launchtemplate:version\":\"3\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "1699", "conditionText": "CA10__tagsJson__c.hasExact(bytes('aws:ec2:fleet-id'))", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-ec2-fleet-tag", "Name": "test-ec2-fleet-tag", "CA10__tagsJson__c": "{\"aws:ec2:fleet-id\":\"fleet-0123456789abcdef0\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-aws-batch-tag-not-standalone-evidence", "Name": "test-aws-batch-tag-not-standalone-evidence", "CA10__tagsJson__c": "{\"AWSBatchServiceTag\":\"batch\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-cloud9-system-tags-not-standalone-evidence", "Name": "test-cloud9-system-tags-not-standalone-evidence", "CA10__tagsJson__c": "{\"aws:cloud9:environment\":\"env-0123456789abcdef0\",\"aws:cloud9:owner\":\"AIDAEXAMPLE\"}", "CA10__disappearanceTime__c": null, "RecordTypeId": "rtId", "RecordType": { "DeveloperName": "RecordType1", "Id": "rtId" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-06-23T00:00:00Z" }, "Id": "test-no-supported-provisioning-tags", "Name": "test-no-supported-provisioning-tags", "CA10__tagsJson__c": "{\"Owner\":\"platform-team\"}", "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-disappeared-ec2-instance", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test-aws-cloudformation-logical-id", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "199", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:logical-id'))", "runtimeError" : null } }, { "Id" : "test-aws-cloudformation-stack-id", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "299", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-id'))", "runtimeError" : null } }, { "Id" : "test-aws-cloudformation-stack-name", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "399", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-name'))", "runtimeError" : null } }, { "Id" : "test-aws-autoscaling-group-name", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "499", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:autoscaling:groupName'))", "runtimeError" : null } }, { "Id" : "test-emr-system-tags", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "599", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:job-flow-id')) && CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:instance-group-role'))", "runtimeError" : null } }, { "Id" : "test-eks-managed-node-group-tags", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "699", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('eks:cluster-name')) && CA10__tagsJson__c.hasExact(bytes('eks:nodegroup-name'))", "runtimeError" : null } }, { "Id" : "test-aws-servicecatalog-portfolioarn", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "799", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:portfolioArn'))", "runtimeError" : null } }, { "Id" : "test-aws-servicecatalog-productarn", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "899", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:productArn'))", "runtimeError" : null } }, { "Id" : "test-aws-servicecatalog-provisioningprincipalarn", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "999", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningPrincipalArn'))", "runtimeError" : null } }, { "Id" : "test-aws-servicecatalog-provisionedproductarn", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1099", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisionedProductArn'))", "runtimeError" : null } }, { "Id" : "test-aws-servicecatalog-provisioningartifactidentifier", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1199", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningArtifactIdentifier'))", "runtimeError" : null } }, { "Id" : "test-aws-application-migration-service-managed", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1299", "conditionText" : "CA10__tagsJson__c.getExact(bytes('AWSApplicationMigrationServiceManaged')) == 'mgn.amazonaws.com'", "runtimeError" : null } }, { "Id" : "test-aws-elastic-disaster-recovery-managed", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1399", "conditionText" : "CA10__tagsJson__c.getExact(bytes('AWSElasticDisasterRecoveryManaged')) == 'drs.amazonaws.com'", "runtimeError" : null } }, { "Id" : "test-elasticbeanstalk-environment-tags", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1499", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-name')) && CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-id'))", "runtimeError" : null } }, { "Id" : "test-emr-single-tag-not-enough", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-eks-single-tag-not-enough", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-elasticbeanstalk-single-tag-not-enough", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-mgn-unexpected-value-not-enough", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-aws-eks-cost-tag-not-standalone-evidence", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-launch-template-system-tags", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1599", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:id')) && CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:version'))", "runtimeError" : null } }, { "Id" : "test-ec2-fleet-tag", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1699", "conditionText" : "CA10__tagsJson__c.hasExact(bytes('aws:ec2:fleet-id'))", "runtimeError" : null } }, { "Id" : "test-aws-batch-tag-not-standalone-evidence", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-cloud9-system-tags-not-standalone-evidence", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test-no-supported-provisioning-tags", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1700", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsInstance__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__disappearanceTime__c" : new Date("2026-06-22T00:00:00Z"), "CA10__tagsJson__c" : "{\"Owner\":\"platform-team\"}", "Id" : "test-disappeared-ec2-instance" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:cloudformation:logical-id\":\"Instance\"}", "Id" : "test-aws-cloudformation-logical-id" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:cloudformation:stack-id\":\"arn:aws:cloudformation:us-east-1:123456789012:stack/test/test\"}", "Id" : "test-aws-cloudformation-stack-id" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:cloudformation:stack-name\":\"test-stack\"}", "Id" : "test-aws-cloudformation-stack-name" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:autoscaling:groupName\":\"test-asg\"}", "Id" : "test-aws-autoscaling-group-name" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:elasticmapreduce:job-flow-id\":\"j-12345678\",\"aws:elasticmapreduce:instance-group-role\":\"CORE\"}", "Id" : "test-emr-system-tags" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"eks:cluster-name\":\"test-cluster\",\"eks:nodegroup-name\":\"test-nodegroup\"}", "Id" : "test-eks-managed-node-group-tags" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:servicecatalog:portfolioArn\":\"arn:aws:catalog:us-east-1:123456789012:portfolio/port-abc123\"}", "Id" : "test-aws-servicecatalog-portfolioarn" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:servicecatalog:productArn\":\"arn:aws:catalog:us-east-1:123456789012:product/prod-abc123\"}", "Id" : "test-aws-servicecatalog-productarn" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:servicecatalog:provisioningPrincipalArn\":\"arn:aws:iam::123456789012:role/provisioning-role\"}", "Id" : "test-aws-servicecatalog-provisioningprincipalarn" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:servicecatalog:provisionedProductArn\":\"arn:aws:servicecatalog:us-east-1:123456789012:stack/test/pp-abc123\"}", "Id" : "test-aws-servicecatalog-provisionedproductarn" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:servicecatalog:provisioningArtifactIdentifier\":\"pa-abc123\"}", "Id" : "test-aws-servicecatalog-provisioningartifactidentifier" }, { "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" : "{\"elasticbeanstalk:environment-name\":\"test-env\",\"elasticbeanstalk:environment-id\":\"e-abc123\"}", "Id" : "test-elasticbeanstalk-environment-tags" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:elasticmapreduce:job-flow-id\":\"j-12345678\"}", "Id" : "test-emr-single-tag-not-enough" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"eks:cluster-name\":\"test-cluster\"}", "Id" : "test-eks-single-tag-not-enough" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"elasticbeanstalk:environment-name\":\"test-env\"}", "Id" : "test-elasticbeanstalk-single-tag-not-enough" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"AWSApplicationMigrationServiceManaged\":\"unexpected\"}", "Id" : "test-mgn-unexpected-value-not-enough" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:eks:cluster-name\":\"test-cluster\"}", "Id" : "test-aws-eks-cost-tag-not-standalone-evidence" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:ec2launchtemplate:id\":\"lt-0123456789abcdef0\",\"aws:ec2launchtemplate:version\":\"3\"}", "Id" : "test-launch-template-system-tags" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:ec2:fleet-id\":\"fleet-0123456789abcdef0\"}", "Id" : "test-ec2-fleet-tag" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"AWSBatchServiceTag\":\"batch\"}", "Id" : "test-aws-batch-tag-not-standalone-evidence" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"aws:cloud9:environment\":\"env-0123456789abcdef0\",\"aws:cloud9:owner\":\"AIDAEXAMPLE\"}", "Id" : "test-cloud9-system-tags-not-standalone-evidence" }, { "context" : { "snapshotTime" : new Date("2026-06-23T00:00:00Z") }, "CA10__tagsJson__c" : "{\"Owner\":\"platform-team\"}", "Id" : "test-no-supported-provisioning-tags" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsInstance__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:cloudformation:logical-id', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:logical-id'))", currentStateMessage: "The automated provisioning source is AWS CloudFormation.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] if (TagsLib.tagExists('aws:cloudformation:stack-id', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-id'))", currentStateMessage: "The automated provisioning source is AWS CloudFormation.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[3], conditionIndex:[300..399] if (TagsLib.tagExists('aws:cloudformation:stack-name', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:cloudformation:stack-name'))", currentStateMessage: "The automated provisioning source is AWS CloudFormation.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[4], conditionIndex:[400..499] if (TagsLib.tagExists('aws:autoscaling:groupName', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:autoscaling:groupName'))", currentStateMessage: "The automated provisioning source is Amazon EC2 Auto Scaling.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[5], conditionIndex:[500..599] if (TagsLib.tagExists('aws:elasticmapreduce:job-flow-id', true, obj.CA10__tagsJson__c) && TagsLib.tagExists('aws:elasticmapreduce:instance-group-role', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 599, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:job-flow-id')) && CA10__tagsJson__c.hasExact(bytes('aws:elasticmapreduce:instance-group-role'))", currentStateMessage: "The automated provisioning source is Amazon EMR.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[6], conditionIndex:[600..699] if (TagsLib.tagExists('eks:cluster-name', true, obj.CA10__tagsJson__c) && TagsLib.tagExists('eks:nodegroup-name', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 699, conditionText: "CA10__tagsJson__c.hasExact(bytes('eks:cluster-name')) && CA10__tagsJson__c.hasExact(bytes('eks:nodegroup-name'))", currentStateMessage: "The automated provisioning source is Amazon EKS.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[7], conditionIndex:[700..799] if (TagsLib.tagExists('aws:servicecatalog:portfolioArn', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 799, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:portfolioArn'))", currentStateMessage: "The automated provisioning source is AWS Service Catalog.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[8], conditionIndex:[800..899] if (TagsLib.tagExists('aws:servicecatalog:productArn', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 899, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:productArn'))", currentStateMessage: "The automated provisioning source is AWS Service Catalog.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[9], conditionIndex:[900..999] if (TagsLib.tagExists('aws:servicecatalog:provisioningPrincipalArn', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 999, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningPrincipalArn'))", currentStateMessage: "The automated provisioning source is AWS Service Catalog.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[10], conditionIndex:[1000..1099] if (TagsLib.tagExists('aws:servicecatalog:provisionedProductArn', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 1099, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisionedProductArn'))", currentStateMessage: "The automated provisioning source is AWS Service Catalog.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[11], conditionIndex:[1100..1199] if (TagsLib.tagExists('aws:servicecatalog:provisioningArtifactIdentifier', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 1199, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:servicecatalog:provisioningArtifactIdentifier'))", currentStateMessage: "The automated provisioning source is AWS Service Catalog.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[12], conditionIndex:[1200..1299] if (TextLib.equal(TagsLib.tagValue('AWSApplicationMigrationServiceManaged', true, obj.CA10__tagsJson__c), 'mgn.amazonaws.com')) { return {status: 'COMPLIANT', conditionIndex: 1299, 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[13], conditionIndex:[1300..1399] if (TextLib.equal(TagsLib.tagValue('AWSElasticDisasterRecoveryManaged', true, obj.CA10__tagsJson__c), 'drs.amazonaws.com')) { return {status: 'COMPLIANT', conditionIndex: 1399, 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[14], conditionIndex:[1400..1499] if (TagsLib.tagExists('elasticbeanstalk:environment-name', true, obj.CA10__tagsJson__c) && TagsLib.tagExists('elasticbeanstalk:environment-id', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 1499, conditionText: "CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-name')) && CA10__tagsJson__c.hasExact(bytes('elasticbeanstalk:environment-id'))", currentStateMessage: "The automated provisioning source is AWS Elastic Beanstalk.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[15], conditionIndex:[1500..1599] if (TagsLib.tagExists('aws:ec2launchtemplate:id', true, obj.CA10__tagsJson__c) && TagsLib.tagExists('aws:ec2launchtemplate:version', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 1599, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:id')) && CA10__tagsJson__c.hasExact(bytes('aws:ec2launchtemplate:version'))", currentStateMessage: "The automated provisioning source is Amazon EC2 launch template.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[16], conditionIndex:[1600..1699] if (TagsLib.tagExists('aws:ec2:fleet-id', true, obj.CA10__tagsJson__c)) { return {status: 'COMPLIANT', conditionIndex: 1699, conditionText: "CA10__tagsJson__c.hasExact(bytes('aws:ec2:fleet-id'))", currentStateMessage: "The automated provisioning source is Amazon EC2 Fleet.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INCOMPLIANT', conditionIndex: 1700, 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__CaAwsInstance__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__CaAwsInstance__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;