Is there any way in AWS policies to enforce that, when someone creates a role, that its policies have a condition (e.g. only accessing resources with a certain tag)?
like "you can create any resource, and any role/etc to act on things, so long as they have a tag XXX"
So people could make things at their leisure, but not be able to make things that access stuff that doesn't have their tag. A kind of pseudo sandboxing.
Would this be something like
{
"Sid": "AllowUserToAttachRolePolicy",
"Effect": "Allow",
"Action": "iam:AttachRolePolicy",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestTag/CreatedBy": "username_as_tag_value"
}
}
}
is this sufficient? Or is there more?
I found an answer to this. I think the following policy is not well-tuned, and may miss certain edge cases.
It did work for what I need - albeit not yet robustly for a 'do anything' sandbox. I'm posting it so it might help others.
If anyone develops a complete answer, I'd be glad to accept theirs