-
-
Notifications
You must be signed in to change notification settings - Fork 251
Add HashiCorp Vault module #1079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cristianrgreco
merged 9 commits into
testcontainers:main
from
inf1nite-lo0p:feature/add-hashicorp-vault-module
Jul 18, 2025
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3d809a6
Implement HashiCorp Vault module
inf1nite-lo0p 6af8163
Add documentation for Vault
inf1nite-lo0p 9d57dd0
Add `codeinclude` markers to test file for documentation embedding
inf1nite-lo0p 85c8091
Remove the empty lines between `codeinclude` markers
inf1nite-lo0p 6a04ce8
Make describe() block naming consistent: `vault` -> `VaultContainer`
inf1nite-lo0p 9403756
Drop unnecessary fake sleep delay
inf1nite-lo0p 7a1579a
Make `image` a required param
inf1nite-lo0p 2f40855
Use consistent wording for `execVaultCommands` thrown err message
inf1nite-lo0p 05211d1
Isolate container lifecycle per test to avoid race conditions
inf1nite-lo0p File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Vault Module | ||
|
|
||
| [Vault](https://www.vaultproject.io/) by HashiCorp is a tool for securely accessing secrets such as API keys, passwords, or certificates. This module allows you to run and initialize a Vault container for integration tests. | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| npm install @testcontainers/vault --save-dev | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| <!--codeinclude--> | ||
|
|
||
| [Start and perform read/write with node-vault:](../../packages/modules/vault/src/vault-container.test.ts) inside_block:readWrite | ||
|
|
||
| <!--/codeinclude--> | ||
|
|
||
| <!--codeinclude--> | ||
|
|
||
| [Run Vault CLI init commands at startup:](../../packages/modules/vault/src/vault-container.test.ts) inside_block:initCommands | ||
|
|
||
| <!--/codeinclude--> | ||
|
|
||
| ## Why use Vault in integration tests? | ||
|
|
||
| With the growing adoption of Vault in modern infrastructure, testing components that depend on Vault for secret resolution or encryption can be complex. This module allows: | ||
|
|
||
| - Starting a local Vault instance during test runs | ||
| - Seeding secrets or enabling engines with Vault CLI | ||
| - Validating app behavior with secured data access | ||
|
|
||
| Use this module to test Vault-backed workflows without the need for pre-provisioned Vault infrastructure. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.