# CfnResourceMetadataContextOptions

Options for `CfnResourceMetadataContext.of()`.

Used as argument in: [CfnResourceMetadataContext.of](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnResourceMetadataContext.html#of)

- Source: [`core/lib/metadata-context.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/core/lib/metadata-context.ts#L234)
- Type last changed: v2.278.0 · 20 Nov 2026

## 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 constructSelector: cdk.IConstructSelector;
const cfnResourceMetadataContextOptions: cdk.CfnResourceMetadataContextOptions = {
  selector: constructSelector,
};
```

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

# construct_selector: cdk.IConstructSelector

cfn_resource_metadata_context_options = cdk.CfnResourceMetadataContextOptions(
    selector=construct_selector
)
```

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.*;

IConstructSelector constructSelector;

CfnResourceMetadataContextOptions cfnResourceMetadataContextOptions = CfnResourceMetadataContextOptions.builder()
        .selector(constructSelector)
        .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;

IConstructSelector constructSelector;

var cfnResourceMetadataContextOptions = new CfnResourceMetadataContextOptions {
    Selector = constructSelector
};
```

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 constructSelector IConstructSelector

cfnResourceMetadataContextOptions := &CfnResourceMetadataContextOptions{
	Selector: constructSelector,
}
```

## Properties

- `selector`: [IConstructSelector](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IConstructSelector.html) = ConstructSelector.cfnResource() — Selects the constructs targeted by `set()` or `clear()`.

  Selection runs during synthesis and only selected `CfnResource` constructs
  are updated. Synthesis fails when no `CfnResource` is selected. The default
  selects a `CfnResource` scope or its immediate `CfnResource` default child.
