-
Notifications
You must be signed in to change notification settings - Fork 4k
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
KMS: addAlias 1.3 ->1.4 upgrade error #3652
Comments
As a workaround, have you tried to override the logical id with your old id? |
I'm going to make a PR to fix the issue, but in the meantime, @McDoit is correct, and you can do the following:
import {Key, CfnAlias} from "@aws-cdk/aws-kms";
// ...
const key = new Key(this, 'TestKey');
const alias = key.addAlias('alias/test');
(alias.node.defaultChild as CfnAlias).overrideLogicalId('TestKeyAlias90FC0DD1'); Tagging @Visorgood if you're interested 👍 |
Hello @nmussy ! This is an amazing reaction from your side! Thanks a lot for looking into it and fixing it. I will consider your approach as temporal, and will be waiting for the next version with the fix included. Thanks a lot once again! |
@nmussy thanks ❤️ |
No problem guys! Sorry again for the inconvenience. And thanks Elad for the quick review. |
Just fyi: I get this also when I stay on |
That's really odd @defel. Could you send the output of your |
sure! See the following diff. There is little bit more happening, bit trying to remove the kms-alias and trying to add it again with a different logical-id was happening multiple times in the last days. I am still on
Sorry, reproduction snippet would be not so easy, but I will try something - brb in some minutes. |
From what I can see, it's not the alias that's changing logical ID, but your key that's changing name and being orphaned, from 'kmskeysdevkmskeydev' to 'kmskeydev' (among other things.) |
I had the KMS-Key and the alias in a cdk-construct - could this cause the change of the logical-id of the kms-key? Because nothing else changed. I will try to reproduce this, but seems to be an other issue then. |
I quickly tried to look how look how IDs are generated but didn't find it, sorry. Good luck! |
Ok thank you, I dont get this reproduced and it's a different issue - I have to look into a little bit more. |
Moving things in and out of constructs will mess with their id's, they are created level for level |
Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.
I'm submitting a ...
What is the current behavior?
If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce
Trying to redeploy a KMS Key alias create pre-1.4.0 with 1.4.0 causes the following error:
CloudFormation attempts to create a new Alias because of the new logical ID because of #3596, but with the same name. This causes the alias name conflict.
What is the expected behavior (or behavior of feature suggested)?
Not to crash. The easier solution I can see is to keep track of the aliases, and only use the new logical ID pattern if there are more than one.
What is the motivation / use case for changing the behavior or adding this feature?
Deploy previously working stacks
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
The issue was originally raised by @Visorgood in #3596
Reproduction steps:
@aws-cdk/core@^1.3.0 @aws-cdk/aws-kms@^1.3.0
@aws-cdk/core@^1.4.0 @aws-cdk/aws-kms@^1.4.0
cdk diff
:The text was updated successfully, but these errors were encountered: