# IResourceWithPolicyV2

A resource with a resource policy that can be added to.

Extends: [IEnvironmentAware](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.IEnvironmentAware.html)
Implemented by: [LambdaRestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.LambdaRestApi.html), [RestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApi.html), [RestApiBase](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApiBase.html), [SpecRestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.SpecRestApi.html), StepFunctionsRestApi, Table, TableBase, TableBaseV2, TableV2, TableV2MultiAccountReplica, FileSystem, EventBus, WebFunction, WebFunctionBase, WebFunctionEndpoint, WebFunctionEndpointBase, LogGroup
Obtainable from: [ResourceWithPolicies.of](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.ResourceWithPolicies.html#of)
Returned by: [IResourcePolicyFactory.forResource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IResourcePolicyFactory.html#forresource)

- Source: [`aws-iam/lib/grant.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-iam/lib/grant.ts#L561)
- Type last changed: v2.224.0 · 13 Nov 2025

## Properties

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

## Methods

- `addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult` — Add a statement to the resource's resource policy.
