Control: Secrets Manager secrets should be rotated within a specified number of days
Description
This control checks whether your secrets have been rotated at least once within 90 days. Rotating secrets can help you to reduce the risk of an unauthorized use of your secrets in your AWS account. Examples include database credentials, passwords, third-party API keys, and even arbitrary text. If you do not change your secrets for a long period of time, the secrets are more likely to be compromised.
Usage
Run the control in your terminal:
powerpipe control run terraform_aws_compliance.control.secretsmanager_secret_automatic_rotation_lambda_enabled
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_aws_compliance.control.secretsmanager_secret_automatic_rotation_lambda_enabled --share
SQL
This control uses a named query:
select address as resource, case when (attributes_std -> 'rotation_rules') is not null and (attributes_std -> 'rotation_lambda_arn') is not null then 'ok' else 'alarm' end as status, split_part(address, '.', 2) || case when (attributes_std -> 'rotation_rules') is not null and (attributes_std -> 'rotation_lambda_arn') is not null then ' scheduled for rotation using Lambda function' else ' automatic rotation using Lambda function disabled' end || '.' as reason , path || ':' || start_linefrom terraform_resourcewhere type = 'aws_secretsmanager_secret';