Registry /
workflow / apache-airflow-providers-hashicorp
Install & Compatibility
Where this runs
tested against v4.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 252.1MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 22.9s · import 0.000s · 250MB
252MB installed
● package 252MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HashicorpVaultHook
✓ from airflow.providers.hashicorp.hooks.vault import HashicorpVaultHook
✗ from airflow.providers.hashicorp.hooks.vault import HashicorpVaultHook
This example DAG demonstrates how to use the `VaultOperator` to read a specific key from a secret stored in Hashicorp Vault. It requires a configured 'vault_default' Airflow connection pointing to your Vault instance with appropriate authentication.
import os
from datetime import datetime
from airflow.models.dag import DAG
from airflow.providers.hashicorp.operators.vault import VaultOperator
# Ensure you have a 'vault_default' connection configured in Airflow with appropriate Vault address and authentication details.
# For local testing, you might need a local Vault instance and a token.
# Example: 'vault_default' connection type: 'Hashicorp Vault', Host: 'http://localhost:8200', Login: 'token', Password: 'your_vault_token'
with DAG(
dag_id='example_vault_read_secret',
start_date=datetime(2023, 1, 1),
schedule=None,
catchup=False,
tags=['vault', 'secrets'],
) as dag:
read_secret = VaultOperator(
task_id='read_my_secret',
vault_conn_id='vault_default', # Ensure this connection is configured
secret_path='secret/data/my-app/db-creds', # Example path, replace with your actual secret path
key='username', # The specific key within the secret to retrieve
result_key='retrieved_db_username', # XCom key to store the result
# Optional: You can specify an output_format, e.g., 'json' or 'plain'
)
# The retrieved value will be pushed to XCom under 'retrieved_db_username'
# You can access it in subsequent tasks like this:
# from airflow.decorators import task
# @task
# def use_secret_value(**kwargs):
# secret_value = kwargs['ti'].xcom_pull(task_ids='read_my_secret', key='retrieved_db_username')
# print(f"Retrieved DB Username: {secret_value}")
#
# use_secret_value()
Debug
Known issues
breakingAirflow providers were refactored in Airflow 2.0+. All `airflow.contrib` imports for Hashicorp components are removed. Using old import paths will result in `ModuleNotFoundError`.fixUpdate all imports from `airflow.contrib.hooks.vault_hook` or `airflow.contrib.operators.vault_operator` to `airflow.providers.hashicorp.hooks.vault` and `airflow.providers.hashicorp.operators.vault` respectively.
affects: Airflow 2.0.0+ (provider versions 1.x and higher)
gotchaConfiguring the Vault secrets backend (`VaultBackend`) requires specific Airflow environment variables (`AIRFLOW__SECRETS__BACKEND`, `AIRFLOW__SECRETS__BACKEND_KWARGS`). Misconfiguration often leads to secrets not being fetched or authentication errors.fixSet `AIRFLOW__SECRETS__BACKEND=airflow.providers.hashicorp.secrets.vault.VaultBackend` and `AIRFLOW__SECRETS__BACKEND_KWARGS='{"vault_url": "http://localhost:8200", "vault_token": "my-token"}'` (or other auth methods) in your Airflow environment. Consult documentation for specific auth methods. affects: All versions
gotchaVault authentication can be complex, and issues often manifest as `hvac.exceptions.VaultError`. Common pitfalls include incorrect tokens, expired credentials, or misconfigured AppRole/Kubernetes authentication.fixDouble-check your Vault connection details in Airflow, ensure the authentication method (token, AppRole, Kubernetes) is correctly configured both in Airflow connection and on the Vault server, and that the credentials have the necessary policies/permissions to access the specified secrets.
affects: All versions
gotchaThe `VaultOperator` and `HashicorpVaultHook` rely on an Airflow connection. If the `vault_conn_id` specified in your DAG does not exist or is misconfigured, tasks will fail with connection errors.fixEnsure an Airflow connection with the specified `vault_conn_id` (e.g., 'vault_default') is created in the Airflow UI (Admin -> Connections) or define it via environment variables (e.g., `AIRFLOW_CONN_VAULT_DEFAULT=vault://<token>@<host>:8200/`).
affects: All versions
Upgrade
Version history
4.7.0latest on PyPI · released Jun 7, 2026
Audit
Dependencies
apache-airflowrequiredThis is an Airflow provider and requires a compatible Airflow installation (>=2.2.0 for provider 4.x).
hvacrequiredThe Hashicorp Vault client library, used by the Vault hook and secrets backend.