I want to set up my deployment pipelines so that they adhere to the principle of least privilege when they deploy assets to AWS. That means I don't want to give the deployment policy admin access or "*:*" privileges.
The problem is that every time I create a new pipeline I have to go through a trial and error process:
- Deploy
- Get a failure due to missing IAM permissions
- Update IAM Policy to add the missing permission
- Repeat
I've searched for resources to help with this, but the general approach seems to be to overprovision the IAM policy, which I think is a really bad approach.
Are there any tools which you can use which will analyse a CloudFormation template and generate a JSON document of the required deployment policy? (Or for Serverless Framework or CDK?)