---
title: Charmhub | Deploy Vault using Charmhub - The Open Operator Collection
description: Deploy the latest version of Vault as a Kubernetes Operator on any cloud.
url: https://charmhub.io/vault-k8s/libraries/vault_helpers
---

# Vault

[Canonical Telco](https://charmhub.io/publisher/telco-charmers "View all packages from Canonical Telco")

* [Canonical Telco](https://charmhub.io/publisher/telco-charmers "View all packages from Canonical Telco")

Platform:

2.0/stable 590

```
juju deploy vault-k8s --channel 2.0/stable
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/vault-k8s/libraries/vault_helpers#drawer)

## charms.vault\_k8s.v0.vault\_helpers

* [*Docstrings*Docstrings](https://charmhub.io/vault-k8s/libraries/vault_helpers)
  [*Code*Source code](https://charmhub.io/vault-k8s/libraries/vault_helpers/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.vault_k8s.v0.vault_helpers
    ```

    [Download vault\_helpers.py](https://charmhub.io/vault-k8s/libraries/vault_helpers/download)
  + *Last updated* 19 Feb 2025
  + *Revision* Library version 0.3

This library contains helper function used when configuring the Vault service.

---

Index

* [class AutounsealConfiguration](https://charmhub.io/vault-k8s/libraries/vault_helpers#autounsealconfiguration)
* [def common\_name\_config\_is\_valid(
  common\_name
  )](https://charmhub.io/vault-k8s/libraries/vault_helpers#common_name_config_is_valid)
* [def render\_vault\_config\_file(
  config\_template\_path,
  config\_template\_name,
  default\_lease\_ttl,
  max\_lease\_ttl,
  cluster\_address,
  api\_address,
  tls\_cert\_file,
  tls\_key\_file,
  tcp\_address,
  raft\_storage\_path,
  node\_id,
  retry\_joins,
  autounseal\_config
  )](https://charmhub.io/vault-k8s/libraries/vault_helpers#render_vault_config_file)
* [def seal\_type\_has\_changed(
  content\_a,
  content\_b
  )](https://charmhub.io/vault-k8s/libraries/vault_helpers#seal_type_has_changed)
* [def config\_file\_content\_matches(
  existing\_content,
  new\_content
  )](https://charmhub.io/vault-k8s/libraries/vault_helpers#config_file_content_matches)

#### class AutounsealConfiguration

Description

Details required for configuring auto-unseal on Vault. None

#### def common\_name\_config\_is\_valid(common\_name: str)

Description

Return whether the config value for the common name is valid. None

#### def render\_vault\_config\_file(     config\_template\_path: str,     config\_template\_name: str,     default\_lease\_ttl: str,     max\_lease\_ttl: str,     cluster\_address: str,     api\_address: str,     tls\_cert\_file: str,     tls\_key\_file: str,     tcp\_address: str,     raft\_storage\_path: str,     node\_id: str,     retry\_joins,     autounseal\_config )

Description

Render the Vault config file. None

#### def seal\_type\_has\_changed(     content\_a: str,     content\_b: str )

Check if the seal type has changed between two versions of the Vault configuration file.

Description

Currently only checks if the transit stanza is present or not, since this
is all we support. This function will need to be extended to support
alternate cases if and when we support them.

#### def config\_file\_content\_matches(     existing\_content: str,     new\_content: str )

Return whether two Vault config file contents match.

Returns

Whether the vault config file content matches

Description

We check if the retry\_join addresses match, and then we check if the rest of the config
file matches.
