-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path40-iam.tf
33 lines (28 loc) · 871 Bytes
/
40-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
resource "aws_iam_instance_profile" "app" {
name = "fr-role-${local.tags["wavestone:project"]}-${var.environment}"
role = aws_iam_role.app.name
}
resource "aws_iam_role" "app" {
name = "fr-role-${local.tags["wavestone:project"]}-${var.environment}"
description = "IAM role for ${local.tags["wavestone:project"]}-${var.environment}"
assume_role_policy = <<EOF
{
"Version" : "2012-10-17",
"Statement" : [
{
"Action" : "sts:AssumeRole",
"Principal" : {
"Service" : "ec2.amazonaws.com"
},
"Effect" : "Allow",
"Sid" : ""
}
]
}
EOF
tags = merge(local.tags,{"Name"="fr-${local.tags["wavestone:project"]}-role-${var.environment}"})
}
resource "aws_iam_role_policy_attachment" "ssmcore"{
role = aws_iam_role.app.name
policy_arn = data.aws_iam_policy.ssmcore.arn
}