secretsmanager_secret
Manage secrets stored in AWS Secrets Manager
Collection: community.aws
Full Name: community.aws.secretsmanager_secret
Synopsis
Manage secrets stored in AWS Secrets Manager
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| access_key | str | |||
| aws_ca_bundle | path | |||
| aws_config | dict | |||
| debug_botocore_endpoint_logs | bool | false | ||
| description | str | |||
| endpoint_url | str | |||
| json_secret | json | |||
| kms_key_id | str | |||
| name | str | yes | ||
| overwrite | bool | true | ||
| profile | str | |||
| purge_tags | bool | true | ||
| recovery_window | int | 30 | ||
| region | str | |||
| replica | list | |||
| resource_policy | json | |||
| rotation_interval | int | 30 | ||
| rotation_lambda | str | |||
| secret | str | |||
| secret_key | str | |||
| secret_type | str | string | ||
| session_token | str | |||
| state | str | present | ||
| tags | dict | |||
| validate_certs | bool | true |
Example
yaml
- name: Add string to AWS Secrets Manager
community.aws.secretsmanager_secret:
name: 'test_secret_string'
state: present
secret_type: 'string'
secret: "{{ super_secret_string }}"
- name: Add a secret with resource policy attached
community.aws.secretsmanager_secret:
name: 'test_secret_string'
state: present
secret_type: 'string'
secret: "{{ super_secret_string }}"
resource_policy: "{{ lookup('template', 'templates/resource_policy.json.j2', convert_data=False) | string }}"
- name: remove string from AWS Secrets Manager
community.aws.secretsmanager_secret:
name: 'test_secret_string'
state: absent
secret_type: 'string'
secret: "{{ super_secret_string }}"
- name: Only create a new secret, but do not update if alredy exists by name
community.aws.secretsmanager_secret:
name: 'random_string'
state: present
secret_type: 'string'
secret: "{{ lookup('community.general.random_string', length=16, special=false) }}"
overwrite: false