forked from nozaq/terraform-aws-secure-baseline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
49 lines (38 loc) · 1.71 KB
/
main.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
# --------------------------------------------------------------------------------------------------
# Password Policy
# --------------------------------------------------------------------------------------------------
resource "aws_iam_account_password_policy" "default" {
count = var.create_password_policy ? 1 : 0
minimum_password_length = var.minimum_password_length
password_reuse_prevention = var.password_reuse_prevention
require_lowercase_characters = var.require_lowercase_characters
require_numbers = var.require_numbers
require_uppercase_characters = var.require_uppercase_characters
require_symbols = var.require_symbols
allow_users_to_change_password = var.allow_users_to_change_password
max_password_age = var.max_password_age
}
# --------------------------------------------------------------------------------------------------
# Support Role
# --------------------------------------------------------------------------------------------------
data "aws_iam_policy_document" "support_assume_policy" {
statement {
principals {
type = "AWS"
identifiers = var.support_iam_role_principal_arns
}
actions = ["sts:AssumeRole"]
}
}
resource "aws_iam_role" "support" {
count = var.create_support_role ? 1 : 0
name = var.support_iam_role_name
assume_role_policy = data.aws_iam_policy_document.support_assume_policy.json
permissions_boundary = var.permissions_boundary_arn
tags = var.tags
}
resource "aws_iam_role_policy_attachment" "support_policy" {
count = var.create_support_role ? 1 : 0
role = aws_iam_role.support[0].id
policy_arn = "arn:aws:iam::aws:policy/AWSSupportAccess"
}