-
Notifications
You must be signed in to change notification settings - Fork 60
/
iam-roles.tf
35 lines (27 loc) · 1.13 KB
/
iam-roles.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
# IAM Roles
## Role for Vault EC2 Instances via AutoScalingGroup
resource "aws_iam_role" "vault_instance" {
name_prefix = "${var.main_project_tag}-instance-role-"
assume_role_policy = data.aws_iam_policy_document.asg_trust_policy.json
}
## Policy Attachments
resource "aws_iam_role_policy" "vault_instance_kms_policy" {
name_prefix = "${var.main_project_tag}-instance-kms-policy-"
role = aws_iam_role.vault_instance.id
policy = data.aws_iam_policy_document.kms_vault_policy.json
}
resource "aws_iam_role_policy" "vault_instance_dynamodb_policy" {
name_prefix = "${var.main_project_tag}-instance-dynamodb-policy-"
role = aws_iam_role.vault_instance.id
policy = data.aws_iam_policy_document.dynamodb_vault_policy.json
}
resource "aws_iam_role_policy" "vault_instance_s3_policy" {
name_prefix = "${var.main_project_tag}-instance-s3-policy-"
role = aws_iam_role.vault_instance.id
policy = data.aws_iam_policy_document.s3_vault_policy.json
}
## Instance Profile
resource "aws_iam_instance_profile" "vault_instance_profile" {
name_prefix = "${var.main_project_tag}-instance-profile-"
role = aws_iam_role.vault_instance.name
}