Documentation
¶
Overview ¶
Package secrets manages encrypted secrets using SOPS and age encryption.
It provides utilities for resolving secret file paths by environment and integrating encrypted secrets with Terraform variables.
Index ¶
- Constants
- Variables
- func FilePathFromEnv(e env.Environment) string
- func Resolve(ctx context.Context, def *appdef.Definition, cfg ResolveConfig) error
- func ResolveForEnvironment(ctx context.Context, def *appdef.Definition, targetEnv env.Environment, ...) error
- type OutputKey
- type ResolveConfig
- type TerraformOutputProvider
Constants ¶
const AgePublicKey = "age1mcl448l48v0e4t5ljek8htn5s07amz5zwr54hkq5qpawgapc9dpstnhksq"
AgePublicKey is the public key for encrypting SOPS files.
Variables ¶
var FilePath = filepath.Join("resources", "secrets")
FilePath defines the path where SOPS encrypted YAML files reside in the Webkit app. Needs a base path prepended.
Functions ¶
func FilePathFromEnv ¶
func FilePathFromEnv(e env.Environment) string
FilePathFromEnv returns a filepath based off the environment.
For example, resources/secrets/{production}.yaml
func Resolve ¶
func Resolve(ctx context.Context, def *appdef.Definition, cfg ResolveConfig) error
func ResolveForEnvironment ¶ added in v0.0.25
func ResolveForEnvironment(ctx context.Context, def *appdef.Definition, targetEnv env.Environment, cfg ResolveConfig) error
ResolveForEnvironment resolves variables for a specific environment only. This is more efficient when you only need one environment (e.g., env generation).
Types ¶
type OutputKey ¶ added in v0.0.25
type OutputKey struct {
Environment env.Environment
ResourceName string
OutputName string
}
OutputKey uniquely identifies a Terraform output value.
type ResolveConfig ¶
type ResolveConfig struct {
SOPSClient sops.EncrypterDecrypter
BaseDir string
TerraformOutput *TerraformOutputProvider
}
ResolveConfig defines the data needed in order to decrypt the definitions environments secrets.
type TerraformOutputProvider ¶ added in v0.0.25
TerraformOutputProvider provides access to Terraform outputs for resource resolution.
func TransformOutputs ¶ added in v0.0.30
func TransformOutputs(result infra.OutputResult, environment env.Environment) TerraformOutputProvider
TransformOutputs converts an OutputResult from Terraform into a TerraformOutputProvider that can be used for secret resolution.
This function extracts resource outputs and creates OutputKeys for each environment/resource/output combination.