# IResourcePolicyFactory

Factory interface for creating IResourceWithPolicyV2 instances from constructs.

Implementations of this interface are registered in the DefaultPolicyFactories registry
and enable automatic resource policy support for CloudFormation resources. When a grant
operation is performed, the factory converts L1 constructs into resources that support
resource-based policies.

Factories are typically registered during static initialization and associated with
specific CloudFormation resource types (e.g., 'AWS::DynamoDB::Table'). The CDK's grant
system uses these factories to determine whether a resource supports resource policies
and to create the appropriate wrapper when needed.

- Source: [`aws-iam/lib/grant.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-iam/lib/grant.ts#L516)
- Type last changed: v2.239.0 · 19 Feb 2026

## Methods

- `forResource(resource: CfnResource): IResourceWithPolicyV2` — Create an IResourceWithPolicyV2 from a construct.

  **Parameters**

  - `resource` — the construct to be wrapped as an IResourceWithPolicyV2.
