Skip to main content

MFA Policy Enforcer

๐Ÿ“ฆ Overviewโ€‹

This Terraform module provisions an IAM policy that enforces Multi-Factor Authentication (MFA) for all IAM users, helping secure AWS accounts against unauthorized access.


โœ… Key Featuresโ€‹

  • Denies AWS API access unless the request is MFA-authenticated
  • Customizable policy name and description
  • Helps enforce organization-wide IAM security standards
  • Tags for environment and usage tracking

๐Ÿ’ผ Use Casesโ€‹

  • Enforce mandatory MFA usage across all IAM users
  • Secure privileged IAM roles with least-privilege + MFA
  • Integrate with compliance frameworks such as CIS, NIST, and ISO
  • Harden IAM authentication layers in staging or production accounts

๐Ÿ“ฅ Input Variablesโ€‹

NameTypeDescription
regionstringAWS region for deployment
policy_namestringName for the IAM policy enforcing MFA
policy_descriptionstringDescription of the policy

๐Ÿ“ค Outputsโ€‹

NameDescription
policy_nameName of the created IAM policy
policy_arnARN of the IAM policy for enforcement

๐Ÿš€ Deployment Readinessโ€‹

  • โœ… Compatible with Terraform 1.0+
  • โœ… Requires AWS Provider 5.x+
  • ๐Ÿ” Requires iam:CreatePolicy permission

๐Ÿ› ๏ธ Example Usageโ€‹

module "mfa_policy_enforcer_deployment" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//identity/mfa-policy-enforcer?ref=v1.0.0"

region = "us-east-1"
policy_name = "EnforceMFAAccess"
policy_description = "Enforces MFA for all IAM users in the account"
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

๐Ÿงน Cleanupโ€‹

Terraform Destroy:

terraform destroy

or

tofu destroy

Manual Deletion:

aws iam delete-policy --policy-arn arn:aws:iam::<account-id>:policy/EnforceMFAAccess

โš ๏ธ If the policy is attached to users or groups, remove those attachments first to avoid lockout.


๐Ÿ›ก๏ธ Notesโ€‹

This is a Level 1 security module designed to enforce MFA across AWS accounts.
To activate the policy, attach it to IAM users, groups, or roles as required.
Make sure at least one user has recovery access in case MFA becomes misconfigured.


๐Ÿ”’ Deployment Package Noticeโ€‹

This module is part of the Level 1 AWS License Tier.
To access the full deployment package and source code, subscribe to Archiphire.