PARALLAX

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

NameTypeRequiredDefaultDescription
access_keystr
aws_ca_bundlepath
aws_configdict
debug_botocore_endpoint_logsboolfalse
descriptionstr
endpoint_urlstr
json_secretjson
kms_key_idstr
namestryes
overwritebooltrue
profilestr
purge_tagsbooltrue
recovery_windowint30
regionstr
replicalist
resource_policyjson
rotation_intervalint30
rotation_lambdastr
secretstr
secret_keystr
secret_typestrstring
session_tokenstr
statestrpresent
tagsdict
validate_certsbooltrue

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
Search
    ↑ ↓ move↵ openesc close