mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-29 03:02:04 +03:00
+18
-13
@@ -1,28 +1,33 @@
|
||||
# group definition
|
||||
resource "aws_iam_group" "administrators" {
|
||||
name = "administrators"
|
||||
name = "administrators"
|
||||
}
|
||||
|
||||
resource "aws_iam_policy_attachment" "administrators-attach" {
|
||||
name = "administrators-attach"
|
||||
groups = ["${aws_iam_group.administrators.name}"]
|
||||
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
|
||||
name = "administrators-attach"
|
||||
groups = [aws_iam_group.administrators.name]
|
||||
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
|
||||
}
|
||||
|
||||
# user
|
||||
resource "aws_iam_user" "admin1" {
|
||||
name = "admin1"
|
||||
name = "admin1"
|
||||
}
|
||||
|
||||
resource "aws_iam_user" "admin2" {
|
||||
name = "admin2"
|
||||
name = "admin2"
|
||||
}
|
||||
|
||||
resource "aws_iam_group_membership" "administrators-users" {
|
||||
name = "administrators-users"
|
||||
users = [
|
||||
"${aws_iam_user.admin1.name}",
|
||||
"${aws_iam_user.admin2.name}",
|
||||
]
|
||||
group = "${aws_iam_group.administrators.name}"
|
||||
name = "administrators-users"
|
||||
users = [
|
||||
aws_iam_user.admin1.name,
|
||||
aws_iam_user.admin2.name,
|
||||
]
|
||||
group = aws_iam_group.administrators.name
|
||||
}
|
||||
|
||||
output "warning" {
|
||||
value = "WARNING: make sure you're not using the AdministratorAccess policy for other users/groups/roles. If this is the case, don't run terraform destroy, but manually unlink the created resources"
|
||||
value = "WARNING: make sure you're not using the AdministratorAccess policy for other users/groups/roles. If this is the case, don't run terraform destroy, but manually unlink the created resources"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user