--- policy: /ce/ca/aws/opensearch/domain-dedicated-master-count logic: /ce/ca/aws/opensearch/domain-dedicated-master-count/prod.logic.yaml executionTime: 2026-06-06T12:03:09.158136542Z generationMs: 69 executionMs: 873 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: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'false' actual: extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'false' runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'true' && extract('CA10__clusterConfigDedicatedMasterCount__c') >= number(3.0) actual: extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'true' && extract('CA10__clusterConfigDedicatedMasterCount__c') >= number(3.0) runtimeError: {} usedFiles: - path: /ce/ca/aws/opensearch/domain-dedicated-master-count/policy.yaml md5Hash: A95087A1EDA8F5857AE1DEC6FF640F72 content: "---\nnames:\n full: \"AWS OpenSearch Domain Dedicated Master Count\ \ is fewer than three\"\n contextual: \"Domain Dedicated Master Count is fewer\ \ than three\"\ndescription: >\n Ensure that Amazon OpenSearch Service domains\ \ use at least three dedicated \n master nodes. Dedicated master nodes increase\ \ cluster stability by offloading \n cluster management tasks from data nodes\ \ and providing a quorum for leader \ntype: \"COMPLIANCE_POLICY\"\ncategories:\n\ \ - \"RELIABILITY\"\nframeworkMappings:\n - \"/frameworks/cloudaware/resource-reliability/system-configuration\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/es/07\"\nsimilarPolicies:\n awsSecurityHub:\n\ \ - name: \"[Opensearch.11] OpenSearch domains should have at least three\ \ dedicated primary nodes\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/opensearch-controls.html#opensearch-11\"\ \n - name: \"[ES.7] Elasticsearch domains should be configured with at least\ \ three dedicated master nodes\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/es-controls.html#es-7\"\ \n" - path: /ce/ca/aws/opensearch/domain-dedicated-master-count/prod.logic.yaml md5Hash: 2D2A04B8E21A35B38EC8EB90BECEE050 content: | --- inputType: "CA10__CaAwsElasticsearchDomain__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10__CaAwsElasticsearchDomain__c/object.extracts.yaml" conditions: - status: "UNDETERMINED" currentStateMessage: "The dedicated master configuration is not populated in the CMDB." check: IS_EMPTY: arg: EXTRACT: "CA10__clusterConfigDedicatedMasterEnabled__c" - status: "INCOMPLIANT" currentStateMessage: "Dedicated master nodes are disabled for this OpenSearch domain." remediationMessage: "Enable dedicated master nodes and set the count to at least 3." check: IS_EQUAL: left: EXTRACT: "CA10__clusterConfigDedicatedMasterEnabled__c" right: TEXT: "false" - status: "INCOMPLIANT" currentStateMessage: "The OpenSearch domain has fewer than 3 dedicated master nodes." remediationMessage: "Increase the dedicated master node count to 3." check: LESS_THAN: left: EXTRACT: "CA10__clusterConfigDedicatedMasterCount__c" right: NUMBER: 3.0 - status: "COMPLIANT" currentStateMessage: "The OpenSearch domain has at least 3 dedicated master nodes." check: AND: args: - IS_EQUAL: left: EXTRACT: "CA10__clusterConfigDedicatedMasterEnabled__c" right: TEXT: "true" - GREATER_THAN_EQUAL: left: EXTRACT: "CA10__clusterConfigDedicatedMasterCount__c" right: NUMBER: 3.0 otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the fields." - path: /ce/ca/aws/opensearch/domain-dedicated-master-count/test-data.json md5Hash: D98F82DDCABEF5A4B48A5867B2D7850F content: |- [ { "expectedResult": { "runtimeError": null, "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex": 99, "status": "DISAPPEARED" }, "CA10__clusterConfigDedicatedMasterCount__c": null, "context": { "snapshotTime": "2025-12-23T10:29:21Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2025-08-17T07:38:43Z", "CA10__clusterConfigDedicatedMasterEnabled__c": "false" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'false'", "conditionIndex": 299, "status": "INCOMPLIANT" }, "CA10__clusterConfigDedicatedMasterCount__c": null, "context": { "snapshotTime": "2025-12-23T10:29:21Z" }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__clusterConfigDedicatedMasterEnabled__c": "false" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'true' && extract('CA10__clusterConfigDedicatedMasterCount__c') >= number(3.0)", "conditionIndex": 499, "status": "COMPLIANT" }, "CA10__clusterConfigDedicatedMasterCount__c": 3.0, "context": { "snapshotTime": "2025-12-23T10:29:21Z" }, "Id": "test3", "CA10__disappearanceTime__c": null, "CA10__clusterConfigDedicatedMasterEnabled__c": "true" } ] - path: /types/CA10__CaAwsElasticsearchDomain__c/object.extracts.yaml md5Hash: C9B19E0A5971D32C19DFC4DEEA0D39EC content: | --- extracts: # Values: true | false (TEXT). Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__created__c" value: FIELD: path: "CA10__created__c" # Values: true | false (TEXT). Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__serviceSoftwareUpdateAvailable__c" value: FIELD: path: "CA10__serviceSoftwareUpdateAvailable__c" undeterminedIf: isEmpty: "The service software update status is not populated in the CMDB." # Values: true | false (TEXT). Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__advancedSecurityEnabled__c" value: FIELD: path: "CA10__advancedSecurityEnabled__c" undeterminedIf: isEmpty: "The fine-grained access control setting is not populated in the CMDB." # Checkbox - name: "CA10__encryptionAtRestEnabled__c" value: FIELD: path: "CA10__encryptionAtRestEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__endpoint__c" value: FIELD: path: "CA10__endpoint__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__vpcEndpoints__c" value: FIELD: path: "CA10__vpcEndpoints__c" # Checkbox - name: "CA10__nodeToNodeEncryptionEnabled__c" value: FIELD: path: "CA10__nodeToNodeEncryptionEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__logPublishingOptionsJson__c" value: FIELD: returnType: "BYTES" path: "CA10__logPublishingOptionsJson__c" - name: "caJsonFrom__logPublishingOptionsJson__c" value: JSON_FROM: arg: EXTRACT: "CA10__logPublishingOptionsJson__c" undeterminedIf: isInvalid: "Log Publishing Options JSON is invalid." # Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigInstanceCount__c" value: FIELD: path: "CA10__clusterConfigInstanceCount__c" # Not nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigZoneAwarenessEnabled__c" value: FIELD: path: "CA10__clusterConfigZoneAwarenessEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigDedicatedMasterEnabled__c" value: FIELD: path: "CA10__clusterConfigDedicatedMasterEnabled__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__clusterConfigDedicatedMasterCount__c" value: FIELD: path: "CA10__clusterConfigDedicatedMasterCount__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__endpointOptionsEnforceHttps__c" value: FIELD: path: "CA10__endpointOptionsEnforceHttps__c" # Nullable. Can't have no access retrieved via es:DescribeDomains - name: "CA10__endpointOptionsTlsSecurityPolicy__c" value: FIELD: path: "CA10__endpointOptionsTlsSecurityPolicy__c" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "runtimeError" : null, "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex" : 99, "status" : "DISAPPEARED" } }, { "Id" : "test2", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'false'", "conditionIndex" : 299, "status" : "INCOMPLIANT" } }, { "Id" : "test3", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'true' && extract('CA10__clusterConfigDedicatedMasterCount__c') >= number(3.0)", "conditionIndex" : 499, "status" : "COMPLIANT" } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsElasticsearchDomain__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-12-23T10:29:21Z") }, "CA10__disappearanceTime__c" : new Date("2025-08-17T07:38:43Z"), "CA10__clusterConfigDedicatedMasterEnabled__c" : "false", "CA10__clusterConfigDedicatedMasterCount__c" : null, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-12-23T10:29:21Z") }, "CA10__clusterConfigDedicatedMasterEnabled__c" : "false", "CA10__clusterConfigDedicatedMasterCount__c" : null, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-12-23T10:29:21Z") }, "CA10__clusterConfigDedicatedMasterEnabled__c" : "true", "CA10__clusterConfigDedicatedMasterCount__c" : 3.0, "Id" : "test3" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsElasticsearchDomain__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__clusterConfigDedicatedMasterEnabled__c STRING, CA10__clusterConfigDedicatedMasterCount__c FLOAT64, 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 extract3() { if (!this.out) { this.out = obj.CA10__clusterConfigDedicatedMasterEnabled__c; } return this.out; }; references1.push('Cluster Config: Dedicated MasterEnabled [obj.CA10__clusterConfigDedicatedMasterEnabled__c]: ' + obj.CA10__clusterConfigDedicatedMasterEnabled__c); if (TextLib.isEmpty(extract3.call(extract3))) { return {status: 'UNDETERMINED', conditionIndex: 199, conditionText: "extract('CA10__clusterConfigDedicatedMasterEnabled__c').isEmpty()", currentStateMessage: "The dedicated master configuration is not populated in the CMDB.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10__clusterConfigDedicatedMasterEnabled__c; } return this.out; }; if (TextLib.equal(extract6.call(extract6), 'false')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'false'", currentStateMessage: "Dedicated master nodes are disabled for this OpenSearch domain.", currentStateReferences: references1.join('\n'), remediation: "Enable dedicated master nodes and set the count to at least 3.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract10() { if (!this.out) { this.out = obj.CA10__clusterConfigDedicatedMasterCount__c; } return this.out; }; references1.push('Cluster Config: Dedicated Master Count [obj.CA10__clusterConfigDedicatedMasterCount__c]: ' + obj.CA10__clusterConfigDedicatedMasterCount__c); if (extract10.call(extract10) != null && 3.0 != null && extract10.call(extract10) < 3.0) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__clusterConfigDedicatedMasterCount__c') < number(3.0)", currentStateMessage: "The OpenSearch domain has fewer than 3 dedicated master nodes.", currentStateReferences: references1.join('\n'), remediation: "Increase the dedicated master node count to 3.", runtimeError: null}; } // condition[4], conditionIndex:[400..499] function extract13() { if (!this.out) { this.out = obj.CA10__clusterConfigDedicatedMasterEnabled__c; } return this.out; }; function extract17() { if (!this.out) { this.out = obj.CA10__clusterConfigDedicatedMasterCount__c; } return this.out; }; if (TextLib.equal(extract13.call(extract13), 'true') && (extract17.call(extract17) != null && 3.0 != null && extract17.call(extract17) >= 3.0)) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__clusterConfigDedicatedMasterEnabled__c') == 'true' && extract('CA10__clusterConfigDedicatedMasterCount__c') >= number(3.0)", currentStateMessage: "The OpenSearch domain has at least 3 dedicated master nodes.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "Unexpected values in the fields.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; SELECT expectedResult.Id as Id, IF ( IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '') AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1) AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '') AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''), "MATCH", "FAIL" ) as match, expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus, expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex, expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText, expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError FROM UNNEST(mock_ExpectedResult()) expectedResult LEFT JOIN ( SELECT sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__clusterConfigDedicatedMasterEnabled__c AS CA10__clusterConfigDedicatedMasterEnabled__c, sObject.CA10__clusterConfigDedicatedMasterCount__c AS CA10__clusterConfigDedicatedMasterCount__c, sObject.Id AS Id, process_CA10__CaAwsElasticsearchDomain__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__clusterConfigDedicatedMasterEnabled__c AS CA10__clusterConfigDedicatedMasterEnabled__c, sObject.CA10__clusterConfigDedicatedMasterCount__c AS CA10__clusterConfigDedicatedMasterCount__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsElasticsearchDomain__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;