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 réponse
0
Réponse acceptée

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
répondu il y a 4 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions