diff --git a/terraform/layer1-aws/README.md b/terraform/layer1-aws/README.md index 2887bd0b..03d3050f 100644 --- a/terraform/layer1-aws/README.md +++ b/terraform/layer1-aws/README.md @@ -34,6 +34,7 @@ |------|------| | [aws_cloudtrail.main](https://registry.terraform.io/providers/aws/4.10.0/docs/resources/cloudtrail) | resource | | [aws_ebs_encryption_by_default.this](https://registry.terraform.io/providers/aws/4.10.0/docs/resources/ebs_encryption_by_default) | resource | +| [aws_iam_account_password_policy.default](https://registry.terraform.io/providers/aws/4.10.0/docs/resources/iam_account_password_policy) | resource | | [aws_kms_key.eks](https://registry.terraform.io/providers/aws/4.10.0/docs/resources/kms_key) | resource | | [aws_s3_bucket.cloudtrail](https://registry.terraform.io/providers/aws/4.10.0/docs/resources/s3_bucket) | resource | | [aws_s3_bucket_acl.cloudtrail](https://registry.terraform.io/providers/aws/4.10.0/docs/resources/s3_bucket_acl) | resource | @@ -59,6 +60,7 @@ |------|-------------|------|---------|:--------:| | [allowed\_account\_ids](#input\_allowed\_account\_ids) | List of allowed AWS account IDs | `list` | `[]` | no | | [allowed\_ips](#input\_allowed\_ips) | IP addresses allowed to connect to private resources | `list(any)` | `[]` | no | +| [aws\_account\_password\_policy](#input\_aws\_account\_password\_policy) | n/a | `any` |
{
"allow_users_to_change_password": true,
"create": true,
"hard_expiry": true,
"max_password_age": "90",
"minimum_password_length": "14",
"password_reuse_prevention": "10",
"require_lowercase_characters": true,
"require_numbers": true,
"require_symbols": true,
"require_uppercase_characters": true
}
| no | | [aws\_cis\_benchmark\_alerts](#input\_aws\_cis\_benchmark\_alerts) | AWS CIS Benchmark alerts configuration | `any` |
{
"email": "demo@example.com",
"enabled": "false",
"rules": {
"aws_config_changes_enabled": true,
"cloudtrail_configuration_changes_enabled": true,
"console_login_failed_enabled": true,
"consolelogin_without_mfa_enabled": true,
"iam_policy_changes_enabled": true,
"kms_cmk_delete_or_disable_enabled": true,
"nacl_changes_enabled": true,
"network_gateway_changes_enabled": true,
"organization_changes_enabled": true,
"parameter_store_actions_enabled": true,
"route_table_changes_enabled": true,
"s3_bucket_policy_changes_enabled": true,
"secrets_manager_actions_enabled": true,
"security_group_changes_enabled": true,
"unauthorized_api_calls_enabled": true,
"usage_of_root_account_enabled": true,
"vpc_changes_enabled": true
}
}
| no | | [az\_count](#input\_az\_count) | Count of avaiablity zones, min 2 | `number` | `3` | no | | [cidr](#input\_cidr) | Default CIDR block for VPC | `string` | `"10.0.0.0/16"` | no | diff --git a/terraform/layer1-aws/aws-iam.tf b/terraform/layer1-aws/aws-iam.tf index d52f69ef..590150a6 100644 --- a/terraform/layer1-aws/aws-iam.tf +++ b/terraform/layer1-aws/aws-iam.tf @@ -1,3 +1,16 @@ +resource "aws_iam_account_password_policy" "default" { + count = var.aws_account_password_policy.create ? 1 : 0 + + minimum_password_length = var.aws_account_password_policy.minimum_password_length + password_reuse_prevention = var.aws_account_password_policy.password_reuse_prevention + require_lowercase_characters = var.aws_account_password_policy.require_lowercase_characters + require_numbers = var.aws_account_password_policy.require_numbers + require_uppercase_characters = var.aws_account_password_policy.require_uppercase_characters + require_symbols = var.aws_account_password_policy.require_symbols + allow_users_to_change_password = var.aws_account_password_policy.allow_users_to_change_password + max_password_age = var.aws_account_password_policy.max_password_age +} + module "vpc_cni_irsa" { source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks" version = "4.14.0" diff --git a/terraform/layer1-aws/variables.tf b/terraform/layer1-aws/variables.tf index ca65d79f..ee039b07 100644 --- a/terraform/layer1-aws/variables.tf +++ b/terraform/layer1-aws/variables.tf @@ -5,6 +5,22 @@ variable "allowed_account_ids" { default = [] } +variable "aws_account_password_policy" { + type = any + default = { + create = true + minimum_password_length = "14" # Minimum length to require for user passwords + password_reuse_prevention = "10" # The number of previous passwords that users are prevented from reusing + require_lowercase_characters = true # If true, password must contain at least 1 lowercase symbol + require_numbers = true # If true, password must contain at least 1 number symbol + require_uppercase_characters = true # If true, password must contain at least 1 uppercase symbol + require_symbols = true # If true, password must contain at least 1 special symbol + allow_users_to_change_password = true # Whether to allow users to change their own password + max_password_age = "90" # How many days user's password is valid + hard_expiry = false # Don't allow users to set a new password after their password has expired + } +} + variable "name" { description = "Project name, required to create unique resource names" }