You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(flags): cdk flags --set --unconfigured --recommended writes false when exactly one flag is unconfigured #2048
When exactly one boolean feature flag is unconfigured, cdk flags --set --unconfigured --recommended shows the recommended value in its preview, but writes false to cdk.json.
This is the bug that #1183 fixed for --all. The fix added !params.all to the single-flag check in modifyValues, so --unconfigured still takes the single-flag path.
Regression Issue
Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
The flag is written with its recommended value, as the preview shows.
Current Behavior
Flag changes:
@aws-cdk/aws-cloudfront:defaultViewerProtocolPolicyRedirectToHttps: <unset> → true
Setting flag '@aws-cdk/aws-cloudfront:defaultViewerProtocolPolicyRedirectToHttps' to: false
Flag value(s) updated successfully.
cdk.json then contains "@aws-cdk/aws-cloudfront:defaultViewerProtocolPolicyRedirectToHttps": false.
Reproduction Steps
Create an app with aws-cdk-lib 2.273.0 whose cdk.json sets every boolean feature flag except @aws-cdk/aws-cloudfront:defaultViewerProtocolPolicyRedirectToHttps (recommended value true).
Run cdk flags --unstable=flags --set --unconfigured --recommended --yes.
The flag is written as false.
With two or more unconfigured flags, the recommended values are written correctly.
Possible Solution
In FlagOperations.modifyValues (packages/aws-cdk/lib/commands/flags/operations.ts), the single-flag branch is meant for cdk flags --set FLAGNAME --value X, but it does not check that --value was given:
buildUpdateObject uses flagNames.length === 1 && params.value !== undefined. Using the same condition in modifyValues would cover --unconfigured and any other multi-flag mode, not only --all.
Activity