2020-05-13 14:25:34 +02:00
|
|
|
provider "aws" {
|
|
|
|
region = "eu-west-2"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_user" "user1" {
|
|
|
|
name = "cedric-user1"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_user_policy_attachment" "policy-user1" {
|
|
|
|
user = aws_iam_user.user1.name
|
|
|
|
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
|
|
|
|
}
|
2020-05-13 14:32:09 +02:00
|
|
|
|
|
|
|
resource "aws_iam_group" "group1" {
|
|
|
|
name = "cedric-group1"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_group_policy_attachment" "policy-group1" {
|
|
|
|
group = aws_iam_group.group1.name
|
|
|
|
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2FullAccess"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_group_membership" "group1-user1" {
|
|
|
|
users = [ aws_iam_user.user1.name ]
|
|
|
|
group = aws_iam_group.group1.name
|
|
|
|
name = "user1-group1-membership"
|
|
|
|
}
|