Skip to main content

Dagster & HashiCorp Vault

Package for integrating HashiCorp Vault into Dagster so that you can securely manage tokens and passwords.

Installation

pip install dagster-hashicorp

Example

# See the Resources docs to learn more: https://docs.dagster.io/concepts/resources

import os

from dagster_hashicorp.vault import vault_resource

import dagster as dg


@dg.asset(required_resource_keys={"vault"})
def example_asset(context):
secret_data = context.resources.vault.read_secret(secret_path="secret/data/foo/bar")
context.log.debug(f"Secret: {secret_data}")


defs = dg.Definitions(
assets=[example_asset],
resources={
"vault": vault_resource.configured(
{
"url": "vault-host:8200",
"auth_type": {"token": {"token": dg.EnvVar("VAULT_AUTH_TOKEN")}},
}
)
},
)

About HashiCorp Vault

HashiCorp provides open source tools and commercial products that enable developers, operators and security professionals to provision, secure, run and connect cloud-computing infrastructure. HashiCorp Vault secures, stores, and tightly controls access to tokens, passwords, certificates, API keys, and other secrets in modern computing.