Skip to main content

prefect-vault

Welcome!

Prefect blocks for HashiCorp Vault.

Getting Started

Python setup

Requires an installation of Python 3.9+.

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.

These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the Prefect documentation.

Installation

Install prefect-vault with pip:

pip install prefect-vault

Create VaultSecret block with token authentication

from prefect_vault import VaultSecret, VaultToken

vault_secret = VaultSecret(
    vault_auth=VaultToken(
        vault_url='http://myvault:8200',
        token='my_secret_token',
    ),
)

await vault_secret.save('my-vault-secret')

Create VaultSecret block with approle authentication

from prefect_vault import VaultAppRole, VaultSecret 

vault_secret = VaultSecret(
    vault_auth=VaultAppRole(
        vault_url='http://myvault:8200',
        role_id='my_role_id',
        secret_id='my_secret_id',
    ),
)

await vault_secret.save('my-vault-secret')

Use VaultSecret in Prefect flow

from prefect import flow
from prefect_vault import VaultSecret


@flow
async def use_vault_secret():
    vault_secret = await VaultSecret.load('my-vault-secret')
    secret_value = vault_secret.get_secret('path/to/my/secret')['secret_key']

Resources

If you encounter any bugs while using prefect-vault, feel free to open an issue in the prefect-vault repository.

If you have any questions or issues while using prefect-vault, you can find help in either the Prefect Discourse forum or the Prefect Slack community.

Development

If you'd like to install a version of prefect-vault for development, clone the repository and perform an editable install with pip:

git clone https://github.com/pbchekin/prefect-vault.git

cd prefect-vault/

pip install -e ".[dev]"

# Install linting pre-commit hooks
pre-commit install

Metadata

Release files for prefect-vault 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prefect-vault 0.2.0
File Size Uploaded
prefect_vault-0.2.0.tar.gz 26.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prefect-vault 0.2.0
File Interpreter ABI Platform
prefect_vault-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / prefect_vault-0.2.0.tar.gz

Download URL prefect_vault-0.2.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bef50a49654b0c54eaa0130a39c04baa24b3a46a78c443714022b024c7e48d5b
BLAKE2b-256 checksum
How to use checksums
c09098bfa2ae9819fb141c6ce3b55bfea088caaeb80bdf989ce26b9490b937a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / prefect_vault-0.2.0-py3-none-any.whl

Download URL prefect_vault-0.2.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00b771ece4033d9deee5175561c5e38fab87cca0da6106a66ff97c1361a43992
BLAKE2b-256 checksum
How to use checksums
50495429203fe394fa4f9caf201b46cd7140e80bc69874fe89b3ec94a09cc453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page