Skip to main content
Pulumi logo Pulumi logo
  1. Docs
  2. Discovery & governance
  3. Reference
  4. Policy fields

Policy fields

    Every policy in a policy pack carries a set of fields that describe it: its name, what it checks, how strictly it’s enforced, how severe a violation is, and how to fix one. You set these fields in the policy pack’s source code, next to the validation logic. When you run pulumi policy publish, they’re published with the pack, and Pulumi Cloud uses them when it displays policies and their violations.

    Where you write the fields depends on the language:

    • TypeScript: properties on each policy object in the policies array passed to new PolicyPack().
    • Python: keyword arguments to ResourceValidationPolicy or StackValidationPolicy. Python uses snake_case names, such as remediation_steps.

    A second, smaller set of fields describes the policy pack as a whole.

    Example

    import * as aws from "@pulumi/aws";
    import { PolicyPack, validateResourceOfType } from "@pulumi/policy";
    
    new PolicyPack("aws-security", {
        enforcementLevel: "advisory",
        policies: [{
            name: "rds-storage-encrypted",
            description: "RDS instances must have storage encryption enabled.",
            displayName: "Encrypt RDS storage",
            enforcementLevel: "mandatory",
            severity: "high",
            tags: ["security", "rds"],
            remediationSteps: "Set storageEncrypted to true on the RDS instance.",
            url: "https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Encryption.html",
            framework: {
                name: "Internal security baseline",
                version: "2026.1",
                reference: "DATA-01",
                specification: "Databases must encrypt data at rest.",
            },
            validateResource: validateResourceOfType(aws.rds.Instance, (instance, args, reportViolation) => {
                if (!instance.storageEncrypted) {
                    reportViolation("RDS instances must have storage encryption enabled.");
                }
            }),
        }],
    });
    
    from pulumi_policy import (
        EnforcementLevel,
        PolicyComplianceFramework,
        PolicyPack,
        ResourceValidationPolicy,
        Severity,
    )
    
    
    def rds_storage_encrypted(args, report_violation):
        if args.resource_type == "aws:rds/instance:Instance" and not args.props.get("storageEncrypted"):
            report_violation("RDS instances must have storage encryption enabled.")
    
    
    PolicyPack(
        name="aws-security",
        enforcement_level=EnforcementLevel.ADVISORY,
        policies=[
            ResourceValidationPolicy(
                name="rds-storage-encrypted",
                description="RDS instances must have storage encryption enabled.",
                display_name="Encrypt RDS storage",
                enforcement_level=EnforcementLevel.MANDATORY,
                severity=Severity.HIGH,
                tags=["security", "rds"],
                remediation_steps="Set storageEncrypted to true on the RDS instance.",
                url="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Encryption.html",
                framework=PolicyComplianceFramework(
                    name="Internal security baseline",
                    version="2026.1",
                    reference="DATA-01",
                    specification="Databases must encrypt data at rest.",
                ),
                validate=rds_storage_encrypted,
            ),
        ],
    )
    

    Policy fields

    TypeScriptPythonRequiredDescription
    namenameYesIdentifier for the policy. Must be unique within the policy pack.
    descriptiondescriptionYesShort summary of what the policy checks and why.
    enforcementLevelenforcement_levelNoWhat happens on a violation: advisory (warn only), mandatory (block the update), remediate (fix the resource automatically), or disabled (turn the policy off). Overrides the pack’s default enforcement level. In Python, use the EnforcementLevel enum. Organization-managed mandatory and remediate enforcement require a paid Pulumi Cloud edition; see pricing.
    severityseverityNoHow serious a violation is: low, medium, high, or critical. In Python, use the Severity enum.
    displayNamedisplay_nameNoHuman-readable name, shown instead of name.
    remediationStepsremediation_stepsNoGuidance for fixing a violation by hand. This is unrelated to the remediate enforcement level, which fixes resources automatically.
    urlurlNoLink to more information about the policy.
    tagstagsNoLabels for grouping and filtering policies.
    frameworkframeworkNoThe compliance framework the policy belongs to. See Framework fields.
    configSchemaconfig_schemaNoSchema for the policy’s configurable parameters. See Configuration schema fields.

    Overriding fields in configuration

    Only enforcementLevel can be overridden without changing the policy pack’s code. Set it in the policy pack’s configuration, either for one policy or for every policy in the pack with the all key:

    {
        "all": "advisory",
        "rds-storage-encrypted": "mandatory"
    }
    

    All other fields, including severity, are fixed when you publish the pack. To change them, update the code and publish a new version. The rest of a policy’s configuration consists of the parameters its configSchema defines, not overrides of these fields.

    Framework fields

    TypeScriptPythonDescription
    namenameName of the compliance framework, for example "PCI DSS", "HIPAA", or "SOC 2".
    versionversionFramework version, for example "4.0".
    referencereferenceThe specific control or requirement within the framework.
    specificationspecificationDescription of the related compliance requirement.

    In TypeScript, all four fields are required when you set framework. In Python, PolicyComplianceFramework accepts each one as optional.

    Configuration schema fields

    TypeScriptPythonRequiredDescription
    propertiespropertiesYesThe configuration options and their JSON Schema types.
    requiredrequiredNoNames of properties that must be supplied when the policy is configured.

    For how to read configuration values inside a policy, see Configuring policy packs.

    Policy pack fields

    These fields describe the pack as a whole. In TypeScript, set them on the arguments to new PolicyPack(). In Python, pass them as keyword arguments to PolicyPack.

    TypeScriptPythonDescription
    policiespoliciesThe policies in the pack. Required.
    enforcementLevelenforcement_levelDefault enforcement level for every policy in the pack. Defaults to advisory. Individual policies can override it.
    descriptiondescriptionBrief description of the pack. Overrides the description in PulumiPolicy.yaml.
    displayNamedisplay_nameHuman-readable name for the pack.
    readmereadmeREADME text for the pack.
    providerproviderThe cloud provider or platform the pack applies to, such as AWS or Azure.
    tagstagsLabels for the pack.
    repositoryrepositoryURL of the repository where the pack is defined.

      The infrastructure as code platform for any cloud.