Skip to main content

Package for integrating Hashicorp Vault with Dagster.

Project description

dagster-hashicorp logo

build codecov

dagster-hashicorp

A package for integrating Hashicorp Vault with Dagster.

Requirements

  • Dagster 0.14+

Installation

Use your favorite Python package manager to install the app from PyPI, e.g.

pip install dagster-hashicorp

Usage Notes

Vault

Auth method

  • Token
  • User / Password
  • Approle
  • Kubernetes

Example

from dagster import build_op_context, job, op
from dagster_hashicorp.vault import vault_resource


@op(required_resource_keys={"vault"})
def example_vault_op(context):
    # Read
    secret_data = context.resources.vault.read_secret(
        secret_path="secret/data/foo/bar"
    )
    context.log.debug(f"Secret: {secret_data}")

    # Write
    context.resources.vault.create_or_update_secret(
        secret_path="secret/data/foo/bar", {"bar": "foo"}
    )


@job(resource_defs={"vault": vault_resource})
def example_job():
    example_vault_op()


example_job.execute_in_process(
    run_config={
        "resources": {
            "vault": {
                "config": {
                    "url": "vault-host:8200",
                    "auth_type": {"token": {"token": "s.your-token"}},
                }
            }
        }
    }
)

# OR use environment variables

example_job.execute_in_process(
    run_config={
        "resources": {
            "vault": {
                "config": {
                    "url": "vault-host:8200",
                    "auth_type": {"token": {"token": {"env": "VAULT_TOKEN"}}},
                    # or
                    # "auth_type": {"userpass": {"username": {"env": "VAULT_USER"}, "password": {"env": "VAULT_PASS"}}},
                    # or
                    # "auth_type": {"approle": {"role_id": {"env": "VAULT_ROLE_ID"}, "secret_id": {"env": "VAULT_SECRET_ID"}}},
                    # or
                    # "auth_type": {"kubernetes": {"role": {"env": "VAULT_ROLE"}, "jwt_path": {"env": "VAULT_JWT_PATH"}}},
                }
            }
        }
    }
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dagster-hashicorp-0.1.1.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

dagster_hashicorp-0.1.1-py2.py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page