-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factor out resources requiring IAM write permissions #36
Comments
I forgot to mention the IAM impact on EKS, which includes the need to supply a cluster role and work instance profile / worker role if they're not created automatically by terraform-deploy/aws. |
On other idea I had for dealing with IAM perms would be to share Terraform .tfstate with our IT department using remote state. Our IT would initially create the entire deployment including IAM. Our development group would then be permitted to perform whatever Terraform actions we have permissions for, relying on Terraform not to repeat the IAM work IT already did. Does this sound feasible? |
There's also problems with scoping. For example, the cluster autoscaler role only needs access to resources created by a specific EKS cluster. This keeps roles as tightly scoped as possible. However, now we end up with a loop:
Steps 2-5 will have to be repeated each time there's any change in our code or a module our code depends on. I'm not at all sure how we can do this in an automated fashion. |
That would be great, @jaytmiller. Unfortunately, I don't know enough about terraform to answer that. Would you be willing to research this and see where it goes? |
Thanks @yuvipanda for drawing attention to the loop. I also noticed an issue with IRSA/OIDC in addition to autoscaling. Definitely agree the loop is a mess and probably fatal for this refactoring approach. |
One way forward is:
This means you don't need unlimited IAM permissions, but much better scoped ones. However, it might be possible to escalate to full IAM permissions from this, but I'm not sure. |
Limiting scope of IAM permissions more is not something we've considered yet; so far our approach for setting minimum perms has just been to factor out IAM write operations entirely and assume IT would create them all. I'll make a note of this approach as another possibility in our discussion with IT. |
@yuvipanda this approach looks interesting. What is your concern exactly as to how it might be possible to escalate to full IAM with this method? |
Considering the case where no IAM write permissions are given by IT some more. One point to mention is that we can have sandbox accounts where devs given full IAM perms. Which makes me think it would be possible for devs to deploy with full perms to a sandbox account where the IAM roles created are then exported to a CloudFormation template to be applied to Prod once IT Security has reviewed the requested IAM role changes. It was not clear to me from Yuvi's earlier comment if Teraform regenerates all IAM roles with new randomly decorated names for each deploy run? Can we consider making those names more static? |
@mfox22 so my experience with AWS is limited, so please take everything I say with lots of salt :) With the goal being fully automated deployment, here are two sets of IAM rights needed:
The list of permissions granted in I hope this makes a little more sense, @mfox22. However, I want to re-iterate that I don't consider myself an AWS or terraform expert, so take this with salt :) There's also no reason this can't be done - I am just worried there's no way this can be done in an automated, upstream friendly way. |
Yes that makes sense @yuvipanda, thank you for laying this out for me in more detail. |
In order to meet the requirements of our IT department, we need to avoid using IAM write permissions and work with pre-existing IAM resources they create for us.
Can you recommend an approach for offloading IAM resource creation? (I'm attempting to solve this and make a PR.)
Two approaches which come to mind are:
Add a flag like var.create_iam_resources and make all the IAM resources in terraform-deploy/aws conditional on it.
Factor out IAM resources to a separate Terraform and then modify terrarform-deploy/aws to refer to those resources.
In addition to the hubploy IAM resources, IAM also ripples through autoscaling, ecr, and oicd where some resources require the cluster to exist already. This causes issues for a simple create-iam-first-create-cluster-next work flow since IAM resources need to be created both before and after the cluster.
The text was updated successfully, but these errors were encountered: