Forked from phisinees/iam_users_group_with_role
Last active
February 1, 2021 11:33
-
-
Save svenlito/93f1232a5485a37bcf0b7590997f4cfc to your computer and use it in GitHub Desktop.
create iam users group with role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "test_group" { | |
source = "terraform-aws-modules/iam/aws//modules/iam-group-with-policies" | |
version = "3.7.0" | |
name = "Test" | |
aws_account_id = local.master_account_id | |
attach_iam_self_management_policy = true | |
group_users = ["sven", "phisinee.s"] | |
custom_group_policy_arns = [ | |
aws_iam_policy.test_group.arn, | |
] | |
providers = { | |
aws = aws.master | |
} | |
} | |
resource "aws_iam_policy" "test_group" { | |
name = "test_group_policy" | |
policy = data.aws_iam_policy_document.test_group.json | |
} | |
data "aws_iam_policy_document" "test_group" { | |
statement { | |
effect = "Allow" | |
actions = ["sts:AssumeRole"] | |
resources = [ | |
"arn:aws:iam::${local.master_account_id}:role/test_group", | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment