# FeatureFlag

A single feature flag.

- Source: [`lib/cloud-assembly/artifact-schema.ts`](https://github.com/aws/aws-cdk-cli/blob/HEAD/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts)
- Type last changed: v2.232.0 · 5 Dec 2025

## Example

TypeScript:

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

declare const recommendedValue: any;
declare const userValue: any;
declare const v1: any;
declare const v2: any;
const featureFlag: cloud_assembly_schema.FeatureFlag = {
  explanation: 'explanation',
  recommendedValue: recommendedValue,
  unconfiguredBehavesLike: {
    v1: v1,
    v2: v2,
  },
  userValue: userValue,
};
```

Python:

```python
from aws_cdk.cloud_assembly_schema import FeatureFlag, UnconfiguredBehavesLike
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cloud_assembly_schema

# recommended_value: Any
# user_value: Any
# v1: Any
# v2: Any

feature_flag = FeatureFlag(
    explanation="explanation",
    recommended_value=recommended_value,
    unconfigured_behaves_like=UnconfiguredBehavesLike(
        v1=v1,
        v2=v2
    ),
    user_value=user_value
)
```

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

Object recommendedValue;
Object userValue;
Object v1;
Object v2;

FeatureFlag featureFlag = FeatureFlag.builder()
        .explanation("explanation")
        .recommendedValue(recommendedValue)
        .unconfiguredBehavesLike(UnconfiguredBehavesLike.builder()
                .v1(v1)
                .v2(v2)
                .build())
        .userValue(userValue)
        .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.Cloud_assembly_schema;

var recommendedValue;
var userValue;
var v1;
var v2;

var featureFlag = new FeatureFlag {
    Explanation = "explanation",
    RecommendedValue = recommendedValue,
    UnconfiguredBehavesLike = new UnconfiguredBehavesLike {
        V1 = v1,
        V2 = v2
    },
    UserValue = userValue
};
```

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 "github.com/aws/aws-cdk-go/awscdk"

var recommendedValue interface{}
var userValue interface{}
var v1 interface{}
var v2 interface{}

featureFlag := &FeatureFlag{
	Explanation: jsii.String("explanation"),
	RecommendedValue: recommendedValue,
	UnconfiguredBehavesLike: &UnconfiguredBehavesLike{
		V1: v1,
		V2: v2,
	},
	UserValue: userValue,
}
```

## Properties

- `explanation`: string — Explanation about the purpose of this flag that can be shown to the user.

  **Default:** No description

- `recommendedValue`: any — The library-recommended value for this flag, if any.

  **Default:** No recommended value.

  It is possible that there is no recommended value.

- `unconfiguredBehavesLike`: [UnconfiguredBehavesLike](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.UnconfiguredBehavesLike.html) = false — The value of the flag that produces the same behavior as when the flag is not configured at all.

  The structure of this field is a historical accident. The type of this field
  should have been boolean, which should have contained the default value for
  the flag appropriate for the *current* version of the CDK library. We are
  not rectifying this accident because doing so

  Instead, the canonical way to access this value is by evaluating
  `unconfiguredBehavesLike?.v2 ?? false`.

- `userValue`: any — The value configured by the user.

  **Default:** Not configured by the user

  This is the value configured at the root of the tree. Users may also have
  configured values at specific locations in the tree; we don't report on
  those.
