-
Notifications
You must be signed in to change notification settings - Fork 10k
Description
I am trying to create a minimal IAM policy which can govern the CRUD of my defined terraform resources in AWS, so I can run terraform with my configuration.
I couldn't find any guidance on this, so I started off by creating an IAM policy with no access, hooking up cloudtrail and cloudwatch logs, and then going through the creation of a VPC (as an example), and watching for what actions were unauthorized, and slowly piecing together an IAM profile which would allow terraform to CRUD a VPC.
The job of tracking which Actions need to be allowed would be made a lot easier if under TF_LOG=true, the debugger would print out which action it was trying to do at the point it got a NotAuthorized.
It also struck me that by looking at the terraform code, that these are all available from the terraform code itself, if you can be bothered to walk through it ...
e.g.
conn.CreateVPC
conn.DescribeVPCAttribute
conn.DescribeRouteTables
I wonder if relevant IAM policies could be autogenerated somehow from this.
In any case a little line of debug present would help millions.
Thanks