> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/storage/appsec2-aws-57.md).

# AWS Secret Manager Automatic Key Rotation is not enabled misconfiguration detected in code

## AWS Secret Manager Automatic Key Rotation is not enabled misconfiguration detected in code

### Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_AWS\_57                     |
| Category - Subcategory | Storage - Alerting                   |
| Provider               | AWS                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | ad71cafd-f8da-4f2e-9b4b-76c1792dcdc7 |

### Impact

This rule detects whether rotation is enabled for Secrets in AWS Secrets Manager. Enabling rotation for secrets helps reduce the risk of unauthorized access to the secrets.

### How to Fix

*Resource:* aws\_secretsmanager\_secret

* *Arguments:* aws\_secretsmanager\_secret\_rotation

### In this Terraform example, an aws\_secretsmanager\_secret resource is declared to create a new secret in AWS Secrets Manager, and an aws\_secretsmanager\_secret\_rotation resource is configured to enable automatic rotation for that secret. The aws\_secretsmanager\_secret\_rotation resource references the secret by its ID and specifies a Lambda function ARN that will handle the rotation logic, with rotation rules stating how frequently the secret should be rotated (e.g., every 30 days). To satisfy the rule, the example assumes that the Lambda function and necessary IAM roles and policies are correctly set up to perform the rotation, which are essential components for enabling and executing automatic rotation. \[source,go]

resource "aws\_secretsmanager\_secret" "example" { name = "example-secret"

## Other necessary configurations

}

+resource "aws\_secretsmanager\_secret\_rotation" "example" {

* secret\_id = aws\_secretsmanager\_secret.example.id
* rotation\_lambda\_arn = aws\_lambda\_function.example.arn
* rotation\_rules {
* automatically\_after\_days = 30
* }
* ## Other necessary configurations

### +}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/storage/appsec2-aws-57.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
