Skip to main content

Policy files and YAML schema

Look up policy repository files, YAML fields, identifier conventions, and test fixture structure.

This reference summarizes common file shapes. Validate required fields and supported values against your repository's current schemas. For directory navigation, see Repository Structure.

Folder and Policy Descriptors​

FileRole
folder.yamlGroups policies; supplies names.full and names.contextual.
policy.yamlIdentifies a policy and its metadata.
section.yamlDescribes a framework section.

Grouping directories under ce use folder descriptors; policy directories use policy descriptors.

Policy Metadata and Identifiers​

FieldPurpose
names.full, names.contextualStandalone and hierarchical labels
descriptionPlain-text summary
typeCOMPLIANCE_POLICY or BEST_PRACTICE
categoriesSECURITY, RELIABILITY, PERFORMANCE, COST
frameworkMappingsDirect section associations
frameworkIgnoreMappingsExclusions from indirect mappings
similarPoliciesRelated vendor rules or policies
tagsCustom classification
impossibleTechnically unenforceable requirement marker

A policy ID identifies its directory; a logic ID includes the filename. For example, /ce/ca/aws/account/aws-support-role and /ce/ca/aws/account/aws-support-role/prod.logic.yaml identify different entities.

Logic Files and Fields​

FieldRequirementPurpose
inputTypeRequiredCMDB type API name
conditionsRequiredOrdered checks
otherwiseRequiredFallback outcome
recordTypesOptionalRecord type restriction
testDataOptionalFixture references
importExtractsOptionalExtract imports
relatedListsOptionalRelated-object checks

In the support-role implementation, inputType is CA10__CaAwsAccount__c. Each condition combines a check, status, and currentStateMessage; violation conditions also provide remediationMessage. Related lists select records through relationshipName and contain their own conditions and fallback.

The production example uses these fixture references:

testData:
- file: test-data.json

prod.logic.yaml is the production implementation; wip.logic.yaml is used during development. See Write policy logic for a complete worked adaptation.

Extract Definitions​

Extract files reside under types/{type}/{name}.extracts.yaml. Their extracts list gives each value a name and an operation under value.

This shortened IAM policy extract illustrates field access and an explicit empty-value diagnostic:

extracts:
- name: CA10__arn__c
value:
FIELD:
path: CA10__arn__c
undeterminedIf:
isEmpty: The policy ARN is unavailable.

Import the existing file in logic evaluated against that type:

importExtracts:
- file: /types/CA10__CaAwsIamPolicy__c/object.extracts.yaml

Use EXTRACT: CA10__arn__c within an expression to retrieve the named value. The built-in support-role check imports this file within its IAM policy related list and compares the result with arn:aws:iam::aws:policy/AWSSupportAccess.

Test Fixture Structure​

test-data.json is an array of test objects. Each object combines expected results, evaluation context, and resource fields:

ElementContents
expectedResult.statusExpected resource outcome
expectedResult.conditionIndexExpected deciding condition index
expectedResult.conditionTextExpected condition representation
expectedResult.runtimeErrorExpected error or null
context.snapshotTimeTimestamp for time-dependent checks
Resource fields and relationshipsInputs needed by the logic

The support-role fixture includes account records with nested IAM policy and attachment lists. Keep those relationships consistent with the selected input type. For fixture preparation and comparisons, follow Test and debug policies.

Minimal File Examples​

An illustrative custom policy.yaml, using the support-role example's classification:

names:
full: Company AWS Account support access is not configured
contextual: Support access is not configured
description: Checks account support access against company requirements.
type: COMPLIANCE_POLICY
categories:
- SECURITY

A grouping directory's folder.yaml supplies its own labels:

names:
full: Company AWS Account Policies
contextual: Account

These descriptors do not implement the requirement. Add logic, documentation, and fixtures using Structure a custom policy, then validate and test the files with your supported tooling.