SecretManagerSecret
A Secret Manager secret resource.
This creates the container for the secret and allows you to access the secret's value. You will need to manually add a value to the secret.
Like all Resources, this class configures itself across multiple Environments.
For more information see the official documentation.
Example Usage
1import launchflow as lf
2
3# Automatically configures a SecretManager Secret in your GCP project
4api_key = lf.gcp.SecretManagerSecret("api-key")
5# Get the latest version of the secret
6value = secret.version()
initialization
Create a new Secret Manager secret resource.
Args:
name (str)
: The name of the secret.
version
1SecretManagerSecret.version(version: str = "latest", use_cache: bool = False) -> bytes
Access a version of the secret.
Args:
version (str)
: The version of the secret to access. Defaults to "latest".use_cache (bool)
: Whether to cache the value of the secret in memory. Defaults to False.
Returns:
- The value of the secret as bytes.
Example usage:
1import launchflow as lf
2
3api_key = lf.gcp.SecretManagerSecret("api-key")
4secret = api_key.version()
add_version
1SecretManagerSecret.add_version(payload: bytes)
Add a version of the secret.
Args:
payload (bytes)
: The payload to add to the secret.
Example usage:
1import launchflow as lf
2
3api_key = lf.gcp.SecretManagerSecret("api-key")
4api_key.add_version(open("api-key.txt", "rb").read())