https://github.com/igorbrites/vault-migrator
Simply migrate a Vault path from a backend to another!
https://github.com/igorbrites/vault-migrator
vault
Last synced: about 1 year ago
JSON representation
Simply migrate a Vault path from a backend to another!
- Host: GitHub
- URL: https://github.com/igorbrites/vault-migrator
- Owner: igorbrites
- Created: 2020-03-05T17:56:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-19T14:54:48.000Z (over 6 years ago)
- Last Synced: 2025-02-02T16:34:21.981Z (over 1 year ago)
- Topics: vault
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vault Migrator
Simply migrate a [Vault](https://www.vaultproject.io/) path from a backend to another!
## Command line
```
Usage: vault-migrator [args]
First you must define the environment variables bellow:
ORIGIN_VAULT_TOKEN
The token with permittion to read the path to be migrated
DESTINATION_VAULT_TOKEN
The token with permittion to write in the migrated path
Args:
-destination-addr string
The Vault Address of the backend that will receive the migration
-destination-is-kvv2
Whether the destination backend is in KV-V2 format
-origin-addr string
The Vault Address of the backend to be migrated
-origin-is-kvv2
Whether the origin backend is in KV-V2 format
-origin-path string
The path to be migrated (no need to pass "data/" when using KV-V2) (default "secret/")
-overwrite
Whether to overwrite the path on destination, if it already exists
```
## Example
To migrate an generic old backend to a new one using KV-V2:
```
$ vault-migrator -origin-addr=https://my-old-vault.example.com -origin-path=secret/ -destination-addr=https://my-new-vault.example.com -destination-is-kvv2
Starting migration of secret/
Listing "secret/"
Listing "secret/my-secret-path/"
Listing "secret/my-secret-path/the-subpath/"
Copying key "secret/my-secret-path/the-subpath/123" to "secret/data/my-secret-path/the-subpath/123"
Key "secret/my-secret-path/the-subpath/123" copied to "secret/data/my-secret-path/the-subpath/123" successfully
Copying key "secret/my-secret-path/the-subpath/1234" to "secret/data/my-secret-path/the-subpath/1234"
Key "secret/my-secret-path/the-subpath/1234" copied to "secret/data/my-secret-path/the-subpath/1234" successfully
Copying key "secret/my-secret-path/the-subpath/12345" to "secret/data/my-secret-path/the-subpath/12345"
Key "secret/my-secret-path/the-subpath/12345" copied to "secret/data/my-secret-path/the-subpath/12345" successfully
Copying key "secret/my-secret-path/the-subpath/14265" to "secret/data/my-secret-path/the-subpath/14265"
Key "secret/my-secret-path/the-subpath/14265" copied to "secret/data/my-secret-path/the-subpath/14265" successfully
Listing "secret/my-secret-path/another-subpath/"
Copying key "secret/my-secret-path/another-subpath/123" to "secret/data/my-secret-path/another-subpath/123"
Key "secret/my-secret-path/another-subpath/123" copied to "secret/data/my-secret-path/another-subpath/123" successfully
Copying key "secret/my-secret-path/another-subpath/1234" to "secret/data/my-secret-path/another-subpath/1234"
```