Attach an existing policy to an existing role in CloudFormation

0

How can a CloudFormation template attach an existing Policy to an existing Role?

From what I see we can:

...but seems like maybe you'd need to resort to a custom resource for the case where both already exist?

For my use case, a solution with either Inline or Managed policies would be fine.

AWS
專家
Alex_T
已提問 4 年前檢視次數 1157 次
1 個回答
0
已接受的答案

This is not possible in CloudFormation today as there is no such resource. Also, if we consider CloudFormation had a resource to do this, it would just be a logical resource that attaches a policy to a role, just like how we have route to route table attachment. So your options are

  1. Use custom resource or
  2. Create a new role and attach an existing policy to it or
  3. Create a new policy and attach it to an existing role or
  4. Create both in CloudFormation
AWS
已回答 4 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南