# GrantWithResourceOptions

Options for a grant operation.

Extends: GrantWithResourceOptions
Extends: CommonGrantOptions

- 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#L48)
- Type last changed: v2.222.0 · 4 Nov 2025

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iam as iam } from 'aws-cdk-lib';

declare const conditions: any;
declare const grantable: iam.IGrantable;
declare const resourceWithPolicyV2: iam.IResourceWithPolicyV2;
const grantWithResourceOptions: iam.GrantWithResourceOptions = {
  actions: ['actions'],
  grantee: grantable,
  resource: resourceWithPolicyV2,
  resourceArns: ['resourceArns'],

  // the properties below are optional
  conditions: {
    conditionsKey: {
      conditionsKey: conditions,
    },
  },
  resourceSelfArns: ['resourceSelfArns'],
};
```

## Properties

- `actions`: string[] (required) — The actions to grant.

- `conditions`: { [key: string]: { [key: string]: any } } — Any conditions to attach to the grant.

  **Default:** No conditions

- `grantee`: [IGrantable](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IGrantable.html) (required) — The principal to grant to.

  **Default:** if principal is undefined, no work is done.

- `resource`: [IResourceWithPolicyV2](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IResourceWithPolicyV2.html) (required) — The resource with a resource policy.

  The statement will be added to the resource policy if it couldn't be
  added to the principal policy.

- `resourceArns`: string[] (required) — The resource ARNs to grant to.

- `resourceSelfArns`: string[] — When referring to the resource in a resource policy, use this as ARN.

  **Default:** Same as regular resource ARNs

  (Depending on the resource type, this needs to be '*' in a resource policy).
