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.

1 Antwort
0
Akzeptierte Antwort

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
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen