> 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
