RenovoSolutions/cdk-library-aws-organization

When allowing an item that already exists to be imported with `importOnDuplicate` rollbacks will try to delete

Opened this issue · 3 comments

Describe the bug
When utilizing importOnDuplicate to import items that already exist.. if the import is successful and something else in the stack fails and the stack rolls back it will try to delete the imported resource. This will inevitably lead to a lot of other errors.

To Reproduce
Steps to reproduce the behavior:

  1. Create an OU manually
  2. Add it to the stack with import on duplicate
  3. Create another OU manually
  4. Add it to the stack after the first OU and dont allow imports on duplicate
  5. Deploy the stack. The first OU will import, the second will fail as expected, and the first one will be deleted.

Expected behavior
If importOnDuplicate is used and the stack is rolling back then delete should retain the item. Perhaps the python code could check the stack state before a delete.

Screenshots

Logs

Additional context

Low priority for now. If an OU is deleted its not a big deal. Accounts cant be deleted. The primary annoyance is broken rollback states.

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

bump