# PolicyViolation

Violation produced by the validation plugin.

- Source: [`core/lib/validation/report.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/core/lib/validation/report.ts#L4)
- Type last changed: v2.251.0 · 24 Apr 2026

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const policyViolation: cdk.PolicyViolation = {
  description: 'description',
  ruleName: 'ruleName',
  violatingResources: [{
    locations: ['locations'],

    // the properties below are optional
    constructPath: 'constructPath',
    resourceLogicalId: 'resourceLogicalId',
    templatePath: 'templatePath',
  }],

  // the properties below are optional
  fix: 'fix',
  ruleMetadata: {
    ruleMetadataKey: 'ruleMetadata',
  },
  severity: 'severity',
};
```

## Properties

- `description`: string (required) — The description of the violation.

- `fix`: string — How to fix the violation.

  **Default:** no fix is provided

- `ruleMetadata`: { [key: string]: string } — Additional metadata to include with the rule results.

  **Default:** no rule metadata

  This can be used to provide additional information that is
  plugin specific. The data provided here will be rendered as is.

- `ruleName`: string (required) — The name of the rule.

- `severity`: string — The severity of the violation, only used for reporting purposes.

  **Default:** no severity

  This is useful for helping the user discriminate between warnings,
  errors, information, etc.

- `violatingResources`: [PolicyViolatingResource](/cdk/api/v2/docs/aws-cdk-lib.PolicyViolatingResource.html)[] (required) — The resources violating this rule.
