Control: Secrets Manager secrets that have not been used in 90 days should be removed
Description
Ensure that AWS Secrets Manager secrets have been accessed within a specified number of days. The rule is non-compliant if a secret has not been accessed in 'unusedForDays' number of days. The default value is 90 days.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.secretsmanager_secret_unused_90_day
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.secretsmanager_secret_unused_90_day --share
SQL
This control uses a named query:
select arn as resource, case when last_accessed_date is null then 'alarm' when date(current_date) - date(last_accessed_date) <= 90 then 'ok' else 'alarm' end as status, case when last_accessed_date is null then title || ' never accessed.' else title || ' last used ' || extract(day from current_timestamp - last_accessed_date) || ' day(s) ago.' end as reason , region, account_idfrom aws_secretsmanager_secret;