-
Notifications
You must be signed in to change notification settings - Fork 249
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
EventbridgeToStepfunctions log group name breaks on redeployment #945
Comments
Thanks - we'll take a look |
We're looking into this deeper, and consulting with the CDK team. In the meantime you can get around the problem for the time being by specifying the Log Group name in the logGroupProps property of EventbridgeToStepFunctionsProp argument. That overrides any physical log name we would create. |
What is needed is a name that is constant within the lifetime of the instance of a stack, but different when a new instance of the stack is created. As the CDK code effectively finishes executing before the actual launching of the template, there is no knowledge of the stack instance in any CDK capability. But when the stack launches there is the stack id available in CloudFormation that has the behavior we need - constant in a stack instance, different in two different stack instances. The unique aspect of the Stack ID is easily obtainable from the STACK_ID pseudo parameter. You can use code like this to generate a physical name based on the STACK_ID:
We will be implementing a fix based on the same principle, but in the meantime the code above should allow you to move forward immediately. I believe this also addresses the CDK Determinism concern, as the template will reference AWS::StackId, so the template should be the same for multiple exections. |
Release 2.39.0 should fix this problem, it include PR #954 |
Deploying the same Stack twice - with no changes - results in 2 different CloudFormation Templates, breaking CDK determinism.
This becomes a double issue for us since our Stack uses quite some custom resources, meaning our first deployment must happen with
--no-rollback
, but a second deployment will fail since it's not only retrying the same Stack as before, but also applying an update (which triggers aReplacement type updates not supported on stack with disable-rollback.
error)Reproduction Steps
EventbridgeToStepfunctions
Construct, letting it generate its own Log Group name.Error Log
Environment
Other
Before, we had the same problem described in issue #920 - this was fixed in PR #922 in a way that I believe goes against CDK best practices: 1 CDK Stacks should be deterministic, they should (in most cases) not depend on external state, e.g. the current time. Synthesising the same Stack twice (against the same account, with the same code in the repo), should result in the same CloudFormation Template.
My recommendation would be to use CDK
Names.uniqueId
2 utility function orconstruct.node.addr
to generate the suffix of the Log Group name, to avoid further issues.This is 🐛 Bug Report
Footnotes
https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html#best-practices-apps ↩
https://docs.aws.amazon.com/cdk/v2/guide/identifiers.html#identifiers_unique_ids ↩
The text was updated successfully, but these errors were encountered: