Open SgarciaSantillana opened 3 years ago
@SgarciaSantillana You can usually work around this by first doing an existence check, before attempting a delete.
This is also in line with the "Delete [... s]hould not fail if the underlying resources are already deleted." comment
In pseudo-code:
try:
kms.delete_alias(alias_arn=physical_resource_id)
except DoesNotExist:
return
or
try:
kms.describe_alias(alias_arn=physical_resource_id)
except DoesNotExist:
return
kms.delete_alias(alias_arn=physical_resource_id)
we are creating KMS Keys via a custom cloudformation stack and noticing the following functionality when a user tries to create a KMS Key with an alias that already exists:
I reckon the issue is the same than in https://github.com/aws-cloudformation/custom-resource-helper/issues/7, there was a branch with a solution, but it was closed.