Skip to content

Instantly share code, notes, and snippets.

@phisinees
Created February 1, 2021 11:19
Show Gist options
  • Save phisinees/66b117e78056c0efb9ff51013112953c to your computer and use it in GitHub Desktop.
Save phisinees/66b117e78056c0efb9ff51013112953c to your computer and use it in GitHub Desktop.
create iam users group with role
resource "aws_iam_group" "business_intelligence_group" {
name = "Business_Intelligence"
}
resource "aws_iam_group_membership" "business_intelligence_group_members" {
group = aws_iam_group.business_intelligence_group.name
name = "Business_Intelligence_Membership"
users = []
}
resource "aws_iam_group_policy_attachment" "business_intelligence_group" {
group = aws_iam_group.business_intelligence_group.name
policy_arn = aws_iam_policy.business_intelligence_policy.arn
}
resource "aws_iam_policy" "business_intelligence_policy" {
name = "bi_group_policy"
policy = data.aws_iam_policy_document.business_intelligence_policy_document.json
}
data "aws_iam_policy_document" "business_intelligence_policy_document" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
resources = [
"arn:aws:iam::${local.master_account_id}:role/Business_Intelligence",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment