app

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config          *Config
	CircleToken     string
	VaultTokenFile  string
	VaultClient     *vault.Client
	TFCloudToken    string
	EnableMetrics   bool
	Metrics         *Metrics
	SpaceliftClient *spacelift.Client
}

App is the main application struct

func NewApp

func NewApp(circleToken, vaultTokenFile, tfCloudToken string, config *Config, enableMetrics bool, spaceliftClient *spacelift.Client) *App

NewApp creates a new App from the given configuration options

func (*App) Run

func (a *App) Run() error

Run starts the application

func (*App) RunOnce added in v1.7.0

func (a *App) RunOnce() error

RunOnce just does a single run for use with a Kubernetes cronjob

type CircleCIConfig

type CircleCIConfig struct {
	Name          string   `mapstructure:"name"`
	VaultRole     *string  `mapstructure:"vault_role"`
	VaultPolicies []string `mapstructure:"vault_policies"`
}

CircleCIConfig represents a specific instance of a CircleCI project we want to update an environment variable for

type Config

type Config struct {
	CircleCI  []CircleCIConfig  `mapstructure:"circleci"`
	TFCloud   []TFCloudConfig   `mapstructure:"tfcloud"`
	Spacelift []SpaceliftConfig `mapstructure:"spacelift"`
	// The address of the vault server to use when creating tokens
	VaultAddress string `mapstructure:"vault_address"`
	// The variable name to use when setting a vault token. Defaults to VAULT_ADDR
	TokenVariable string `mapstructure:"token_variable"`
	// If true, all tokens will be created with the orphan flag set to true
	OrphanTokens bool `mapstructure:"orphan_tokens"`
	// The TTL of the tokens that will be created. Defaults to 30 minutes
	TokenTTL time.Duration `mapstructure:"token_ttl"`
	// The interval at which the token will be refreshed. Defaults to 1 hour
	TokenRefreshInterval time.Duration `mapstructure:"token_refresh_interval"`
}

Config represents the configuration file

type Metrics added in v1.5.2

type Metrics struct {
	// contains filtered or unexported fields
}

type SpaceliftConfig added in v1.9.0

type SpaceliftConfig struct {
	// Stack is the name of a Spacelift stack that you want to inject vars into
	Stack string `mapstructure:"stack"`
	// VaultRole is the vault role to use for the token in this stack
	VaultRole *string `mapstructure:"vault_role"`
	// VaultPolicies is a list of policies that will be given to the token in this stack
	VaultPolicies []string `mapstructure:"vault_policies"`
}

type TFCloudConfig added in v1.0.0

type TFCloudConfig struct {
	// Workspace is the ID of the workspace in tfcloud. Should begin with ws- and is required
	Workspace string `mapstructure:"workspace"`
	// Name is an optional field that can be used to identify a workspace
	Name string `mapstructure:"name"`
	// VaultRole is the vault role to use for the token in this workspace
	VaultRole *string `mapstructure:"vault_role"`
	// VaultPolicies is a list of policies that will be given to the token in this workspace
	VaultPolicies []string `mapstructure:"vault_policies"`
}

TFCloudConfig represents a specific instance of a TFCloud workspace we want to update an environment variable for

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL