boto3_secretsmanager

Manage AWS Secrets Manager secrets with boto3.

Create and optionally update secrets in AWS Secrets Manager. Secret values are accepted through state data but are not included in state changes.

depends:
  • boto3 >= 1.28.0

  • botocore >= 1.31.0

This state module uses the boto3_secretsmanager execution module and the standard AWS credential and profile configuration supported by that module.

Added in version 1.1.0.

saltext.boto3.states.boto3_secretsmanager.__virtual__()[source]

Only load when the Secrets Manager execution module is available.

saltext.boto3.states.boto3_secretsmanager.present(name, secret_string=None, secret_data=None, description=None, kms_key_id=None, tags=None, update=False, region=None, key=None, keyid=None, profile=None)[source]

Ensure a Secrets Manager secret exists, optionally updating its value.

name (str):

Name or ARN of the secret.

secret_string (str):

String value for the secret. Mutually exclusive with secret_data.

secret_data (dict):

JSON-serializable data to serialize as the secret value. Mutually exclusive with secret_string.

description (str):

Optional description for a newly created secret.

kms_key_id (str):

Optional KMS key ID or ARN used to encrypt a newly created secret.

tags (dict):

Optional mapping of tag names to tag values for a newly created secret.

update (bool):

If True, store the requested value as a new version when the secret already exists. The default is False.

region (str):

AWS region where the secret is stored.

key (str):

AWS access key ID.

keyid (str):

AWS secret access key.

profile (str):

AWS profile to use for the connection.

Example:

mysecret:
  boto3_secretsmanager.present:
    - secret_string: 'mysecretvalue'
    - description: 'My secret description'
    - kms_key_id: 'my-kms-key-id'
    - tags:
        Environment: 'production'
    - update: True
    - region: 'us-east-1'
    - key: 'my-access-key-id'
    - keyid: 'my-secret-access-key'
    - profile: 'my-aws-profile'
saltext.boto3.states.boto3_secretsmanager.rotation_present(name, rotation_lambda_arn, schedule_expression=None, automatically_after_days=None, duration=None, region=None, key=None, keyid=None, profile=None)[source]

Ensure Lambda-based automatic rotation is configured for a secret.

This configures the schedule without immediately rotating the credential. Secrets Manager validates the rotation configuration by invoking the Lambda’s testSecret step. This state does not configure service-managed rotation, such as an RDS-managed master password.

Example:

rotate_dso_app_password:
  boto3_secretsmanager.rotation_present:
    - name: dhs-dso-dev-rds-app
    - rotation_lambda_arn: arn:aws:lambda:us-east-1:123456789012:function:rotate-dso-rds
    - automatically_after_days: 90
saltext.boto3.states.boto3_secretsmanager.managed_rotation_present(name, schedule_expression=None, automatically_after_days=None, duration=None, region=None, key=None, keyid=None, profile=None)[source]

Ensure a service-managed rotation schedule without a Lambda function.

The secret must already have service-managed rotation enabled. This state updates its schedule only and never initiates an immediate rotation.

name (str):

Name or ARN of an existing service-managed secret.

schedule_expression (str, optional):

Secrets Manager rate() or cron() rotation schedule.

automatically_after_days (int, optional):

Number of days between rotations. Mutually exclusive with schedule_expression.

duration (str, optional):

Rotation window duration, such as 2h. Requires schedule_expression.

region (str, optional):

AWS region where the secret is stored.

key (str, optional):

AWS access key ID.

keyid (str, optional):

AWS secret access key.

profile (str, optional):

AWS profile to use for the connection.

Example:

rotate_dso_master_password_schedule:
  boto3_secretsmanager.managed_rotation_present:
    - name: dhs-dso-dev-rds-master
    - automatically_after_days: 90
saltext.boto3.states.boto3_secretsmanager.absent(name, region=None, key=None, keyid=None, profile=None)[source]

Ensure a Secrets Manager secret is absent.

name (str):

Name or ARN of the secret.

region (str):

AWS region where the secret is stored.

key (str):

AWS access key ID.

keyid (str):

AWS secret access key.

profile (str):

AWS profile to use for the connection.

Example:

mysecret:
  boto3_secretsmanager.absent:
    - region: 'us-east-1'
    - key: 'my-access-key-id'
    - keyid: 'my-secret-access-key'
    - profile: 'my-aws-profile'