Cloudformation cannot delete RolePolicy resource that has no name

0

I'm working with Cloudformation and have a stack I cannot delete because one of the nested stacks fails to delete. This nested stack fails to delete with the following reason:

Resource handler returned message: "Policy name and Role cannot be empty" (RequestToken: 2144f496-855c-85c2-b2d4-347d66e8b00a, HandlerErrorCode: InvalidRequest)

This is also the same reason the RolePolicy failed to create: in my Cloudformation template I had defined a AWS::IAM::RolePolicy resource with an empty PolicyName property.

How do I delete the policy and the stack?

2回答
0
承認された回答

When deleting the stack there's the option to retain resources - in this case the RolePolicy - up until now I've been trying to delete it along with the stack. I've been playing around with the AWS CLI to see if I could find the policy and somehow delete it via CLI, with no luck. I reasoned that maybe the policy doesn't actually exist, so if I choose to keep it when deleting the stack, Cloudformation won't attempt to delete the faulty or non-existent policy and will succeed at deleting the stack. That seems to have done the trick.

Maybe there's a bug somewhere, but not one that creates a RolePolicy with no name, but instead one that tried to delete a RolePolicy that a) doesn't exist, and b) has no name.

As far as I can tell, there are no extraneous RolePolicy objects in IAM associated with my account, so I assume I'm good to go!

回答済み 9ヶ月前
0

Hello.
what about manually deleting the target resource from the management console before deleting the CloudFormation template?
Is it possible to try to delete the CloudFormation template after manually deleting it?

profile picture
エキスパート
回答済み 9ヶ月前
profile pictureAWS
エキスパート
レビュー済み 9ヶ月前
  • I've tried deleting from console. I can't delete the Cloudformation resource because of the aforementioned error, and I can't find the RolePolicy in IAM to delete it (and circumvent the error in Cloudformation.) I tried deleting the Role manually, too, which succeeded but didn't help.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ