-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
❗ NOTICE (cloudformation-include): RuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
overrideLogicalId validation causing CfnInclude to error on Condition logical Id
#30669
Comments
Thanks @mjgoble for creating this issue. You're right that the logical id validation code is applied not only on the |
This is a regression so I'm labeling it a p0 and reverting the original PR. |
Revert: #30695 |
|
1 similar comment
|
RuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
overrideLogicalId validation causing CfnInclude to error on Condition logical Id
RuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
overrideLogicalId validation causing CfnInclude to error on Condition logical IdRuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
overrideLogicalId validation causing CfnInclude to error on Condition logical Id
RuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
overrideLogicalId validation causing CfnInclude to error on Condition logical IdRuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
overrideLogicalId validation causing CfnInclude to error on Condition logical Id
CDK CLI notice for aws/aws-cdk#30669
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Please add your +1 👍 to let us know you have encountered this
Status: RESOLVED
Fixed in v2.147.2
Overview:
New synth time logical Id checks for CloudFormation Resources are also being applied to CloudFormation Conditions. Resource ID validation is more strict that Condition ID validation, causing valid Conditions to be caught by the new validation, and errors to be thrown.
Specifically, this bug affects
cloudformation-include
. When trying tocfnInclude
a CloudFormation template that has defined Conditions using non-alphanumeric characters, e.g. snake casemy_condition
, will now throw an error.Complete Error Message:
RuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
Workaround:
Pin the version of aws-cdk-lib to 2.146.0.
Solution:
Revert breaking PR.
Related Issues:
Original report
Describe the bug
The following PR #29708 introduced validation for
overrideLogicalId
This has caused an issue with
cloudformation-include
when trying to cfnInclude a cloudformation template that has defined Conditions using non-alphanumeric characters, e.g. snake casemy_condition
Cloudformation include by default preserves the logical Id that is defined in the cloudformation template. This is done in part by using the
overrideLogicalId
function to ensure the logical id of the resource is not changed during the cdk synthaws-cdk/packages/aws-cdk-lib/cloudformation-include/lib/cfn-include.ts
Lines 771 to 775 in cce10b1
Now due to the new validation on
overrideLogicalId
- Conditions cannot be defined as non-alphanumeric despite them never actually being deployed as resources in CloudformationExpected Behavior
Stack synth completes successfully, logical Ids defined in the included cloudformation template is preserved, including the snake case Condition logical Ids
Cloudformation deploy succeeds even despite having non-alphanumeric logical Ids defined for
Conditions
Current Behavior
Stack synth fails with a Runtime Error
RuntimeError: Invalid logical ID override: 'my_condition'. It must only contain alphanumeric characters.
Reproduction Steps
cfn_include a cloudformation template that defines conditions using snake case logical id, e.g.
my_condition
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.147.1
Framework Version
No response
Node.js Version
20.5.0
OS
Linux
Language
Python
Language Version
Python (3.12.3)
Other information
No response
The text was updated successfully, but these errors were encountered: