-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam.tf
67 lines (56 loc) · 3.28 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Update Alternate Contacts
## aft-alternate-contacts-extract
resource "aws_iam_role" "aft_alternate_contacts_extract_lambda_role" {
name = "aft-alternate-contacts-extract-lambda-role"
assume_role_policy = templatefile("${path.module}/iam/trust-policies/lambda.tpl", { none = "none" })
}
resource "aws_iam_role_policy_attachment" "aft_alternate_contacts_extract_lambda_role_policy_attachment" {
count = length(local.lambda_managed_policies)
role = aws_iam_role.aft_alternate_contacts_extract_lambda_role.name
policy_arn = local.lambda_managed_policies[count.index]
}
## aft-alternate-contacts-add
resource "aws_iam_role" "aft_alternate_contacts_add_lambda_role" {
name = "aft-alternate-contacts-add-lambda-role"
assume_role_policy = templatefile("${path.module}/iam/trust-policies/lambda.tpl", { none = "none" })
}
resource "aws_iam_role_policy_attachment" "aft_alternate_contacts_add_lambda_role_policy_attachment" {
count = length(local.lambda_managed_policies)
role = aws_iam_role.aft_alternate_contacts_add_lambda_role.name
policy_arn = local.lambda_managed_policies[count.index]
}
resource "aws_iam_role_policy" "aft_alternate_contacts_add_lambda_role_policy" {
name = "aft-alternate-contacts-add-lambda-role-policy"
role = aws_iam_role.aft_alternate_contacts_add_lambda_role.id
policy = templatefile("${path.module}/iam/role-policies/lambda-aft-alternate-contacts-add-lambda-role-policy.tpl", {
data_aws_region = data.aws_region.aft_management_region.name
data_aws_account_id = data.aws_caller_identity.aft_management_id.account_id
data_aft_request_metadata = data.aws_ssm_parameter.aft_request_metadata_table_name.value
data_aft_request_metadata_kms_arn = data.aws_dynamodb_table.aft_request_metadata_table.server_side_encryption[0].kms_key_arn
data_aws_ct_mgt_account_id = var.aws_ct_mgt_account_id
data_aws_ct_mgt_org_id = var.aws_ct_mgt_org_id
})
}
## aft-alternate-contacts-validate
resource "aws_iam_role" "aft_alternate_contacts_validate_lambda_role" {
name = "aft-alternate-contacts-validate-lambda-role"
assume_role_policy = templatefile("${path.module}/iam/trust-policies/lambda.tpl", { none = "none" })
}
resource "aws_iam_role_policy_attachment" "aft_alternate_contacts_validate_lambda_role_policy_attachment" {
count = length(local.lambda_managed_policies)
role = aws_iam_role.aft_alternate_contacts_validate_lambda_role.name
policy_arn = local.lambda_managed_policies[count.index]
}
## aft-alternate-contacts-customizations
resource "aws_iam_role" "aft_alternate_contacts_state_role" {
name = "aft-alternate-contacts-state-role"
assume_role_policy = templatefile("${path.module}/iam/trust-policies/states.tpl", { none = "none" })
}
resource "aws_iam_role_policy" "aft_alternate_contacts_state_role_policy" {
name = "aft-alternate-contacts-state-role-policy"
role = aws_iam_role.aft_alternate_contacts_state_role.id
policy = templatefile("${path.module}/iam/role-policies/state-aft-alternate-contacts-role-policy.tpl", {
data_aws_region = data.aws_region.aft_management_region.name
data_aws_account_id = data.aws_caller_identity.aft_management_id.account_id
})
}