# CustomResourceProviderOptions

Initialization options for custom resource providers.

- Source: [`core/lib/custom-resource-provider/shared.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/core/lib/custom-resource-provider/shared.ts#L9)
- Type last changed: v2.116.0 · 22 Dec 2023

## Example

TypeScript:

```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';

declare const policyStatements: any;
declare const size: cdk.Size;
const customResourceProviderOptions: cdk.CustomResourceProviderOptions = {
  description: 'description',
  environment: {
    environmentKey: 'environment',
  },
  memorySize: size,
  policyStatements: [policyStatements],
  timeout: cdk.Duration.minutes(30),
  useCfnResponseWrapper: false,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

# policy_statements: Any
# size: cdk.Size

custom_resource_provider_options = cdk.CustomResourceProviderOptions(
    description="description",
    environment={
        "environment_key": "environment"
    },
    memory_size=size,
    policy_statements=[policy_statements],
    timeout=cdk.Duration.minutes(30),
    use_cfn_response_wrapper=False
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

Object policyStatements;
Size size;

CustomResourceProviderOptions customResourceProviderOptions = CustomResourceProviderOptions.builder()
        .description("description")
        .environment(Map.of(
                "environmentKey", "environment"))
        .memorySize(size)
        .policyStatements(List.of(policyStatements))
        .timeout(Duration.minutes(30))
        .useCfnResponseWrapper(false)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var policyStatements;
Size size;

var customResourceProviderOptions = new CustomResourceProviderOptions {
    Description = "description",
    Environment = new Dictionary<string, string> {
        { "environmentKey", "environment" }
    },
    MemorySize = size,
    PolicyStatements = new [] { policyStatements },
    Timeout = Duration.Minutes(30),
    UseCfnResponseWrapper = false
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"

var policyStatements interface{}
var size Size

customResourceProviderOptions := &CustomResourceProviderOptions{
	Description: jsii.String("description"),
	Environment: map[string]*string{
		"environmentKey": jsii.String("environment"),
	},
	MemorySize: size,
	PolicyStatements: []interface{}{
		policyStatements,
	},
	Timeout: cdk.Duration_Minutes(jsii.Number(30)),
	UseCfnResponseWrapper: jsii.Boolean(false),
}
```

## Properties

- `description`: string — A description of the function.

  **Default:** No description.

- `environment`: { [key: string]: string } — Key-value pairs that are passed to Lambda as Environment.

  **Default:** No environment variables.

- `memorySize`: [Size](/cdk/api/v2/docs/aws-cdk-lib.Size.html) = Size.mebibytes(128) — The amount of memory that your function has access to.

  Increasing the
  function's memory also increases its CPU allocation.

- `policyStatements`: any[] — A set of IAM policy statements to include in the inline policy of the provider's lambda function.

  **Default:** no additional inline policy

  **Please note**: these are direct IAM JSON policy blobs, *not* `iam.PolicyStatement`
  objects like you will see in the rest of the CDK.

  ```ts
  const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', {
    codeDirectory: `${__dirname}/my-handler`,
    runtime: CustomResourceProviderRuntime.NODEJS_18_X,
    policyStatements: [
      {
        Effect: 'Allow',
        Action: 's3:PutObject*',
        Resource: '*',
      }
    ],
  });
  ```

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.minutes(15) — AWS Lambda timeout for the provider.

- `useCfnResponseWrapper`: boolean — Whether or not the cloudformation response wrapper (`nodejs-entrypoint.ts`) is used. If set to `true`, `nodejs-entrypoint.js` is bundled in the same asset as the custom resource and set as the entrypoint. If set to `false`, the custom resource provided is the entrypoint.

  **Default:** `true` if `inlineCode: false` and `false` otherwise.
