-
Notifications
You must be signed in to change notification settings - Fork 2
/
iam.tf
35 lines (30 loc) · 845 Bytes
/
iam.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
resource "aws_iam_policy" "komiser_policy" {
name = "komiser_policy"
description = "Komiser recommended IAM policy"
policy = file("policy.json")
}
resource "aws_iam_role" "komiser_role" {
name = "komiser_role"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Sid = "RoleForEC2"
Principal = {
Service = "ec2.amazonaws.com"
}
},
]
})
}
resource "aws_iam_policy_attachment" "komiser_attach_policy" {
name = "komiser_attach_policy"
roles = [aws_iam_role.komiser_role.name]
policy_arn = aws_iam_policy.komiser_policy.arn
}
resource "aws_iam_instance_profile" "komiser_instance_profile" {
name = "komiser_instance_profile"
role = aws_iam_role.komiser_role.name
}