# Error: Error putting IAM policy: LimitExceeded: Cannot exceed quota for PolicySize: 5120

- **ID:** `policy/terraform-aws-iam-policy-size-limit`
- **Domain:** policy
- **Category:** resource_error
- **Error Code:** `LimitExceeded`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

AWS IAM policy document has a maximum size of 5120 characters (including whitespace), and the generated policy exceeds this limit due to many resource ARNs or conditions.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| AWS IAM | active | — | — |
| Terraform v1.5+ | active | — | — |

## Workarounds

1. **Split the policy into multiple managed policies and attach them to the same role or user.** (85% success)
   ```
   Split the policy into multiple managed policies and attach them to the same role or user.
   ```
2. **Use wildcards in resource ARNs to reduce policy size (if security allows).** (70% success)
   ```
   Use wildcards in resource ARNs to reduce policy size (if security allows).
   ```

## Dead Ends

- **** — This increases the policy size further, making the error worse. (95% fail)
- **** — Inline policies have the same 5120 character limit and are harder to manage at scale. (60% fail)
