Version: v0.0.12 Latest Latest

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

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 3 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Config

type Config struct {
	TFC                  *TFC      `hcl:"tfc,block"`
	Defaults             *Defaults `hcl:"defaults,block"`
	TerraformVariables   Variables `hcl:"tfvar,block"`
	EnvironmentVariables Variables `hcl:"envvar,block"`

	Runtime Runtime

Config handles all components that can be defined in a tfcw config file

func (*Config) ComputeNewVariableExpirations

func (cfg *Config) ComputeNewVariableExpirations(updatedVariables Variables, existingVariableExpirations VariableExpirations) (variableExpirations VariableExpirations, hasChanges bool, err error)

ComputeNewVariableExpirations ...

func (*Config) GetVariableTTL

func (cfg *Config) GetVariableTTL(v *Variable) (ttl time.Duration, err error)

GetVariableTTL returns the TTL of a variable

func (*Config) GetVariables

func (cfg *Config) GetVariables() (variables Variables)

GetVariables returns a Variables containing the configured variables

func (*Config) GetVariablesToUpdate

func (cfg *Config) GetVariablesToUpdate(variableExpirations VariableExpirations) (variables Variables, err error)

GetVariablesToUpdate returns the list of the variables to update based on the current configuration and the existing variables

type Defaults

type Defaults struct {
	Variable *VariableDefaults `hcl:"var,block"`
	Vault    *Vault            `hcl:"vault,block"`
	S5       *S5               `hcl:"s5,block"`

Defaults can handle default values for some providers

type Env

type Env struct {
	Variable string `hcl:"variable"`

Env is a provider type

type Runtime

type Runtime struct {
	WorkingDir string
	TFC        struct {
		Address      string
		Token        string
		Organization string
		Workspace    string

Runtime is a struct used by the client in order to store values configured at runtime

type S5

type S5 struct {
	CipherEngineType  *S5CipherEngineType  `hcl:"engine"`
	CipherEngineAES   *S5CipherEngineAES   `hcl:"aes,block"`
	CipherEngineAWS   *S5CipherEngineAWS   `hcl:"aws,block"`
	CipherEngineGCP   *S5CipherEngineGCP   `hcl:"gcp,block"`
	CipherEnginePGP   *S5CipherEnginePGP   `hcl:"pgp,block"`
	CipherEngineVault *S5CipherEngineVault `hcl:"vault,block"`
	Value             *string              `hcl:"value"`

S5 is a provider type

type S5CipherEngineAES

type S5CipherEngineAES struct {
	Key *string `hcl:"key"`

S5CipherEngineAES handles necessary configuration for an 'aes' s5 cipher engine

type S5CipherEngineAWS

type S5CipherEngineAWS struct {
	KmsKeyArn *string `hcl:"kms-key-arn"`

S5CipherEngineAWS handles necessary configuration for an 'aws' s5 cipher engine

type S5CipherEngineGCP

type S5CipherEngineGCP struct {
	KmsKeyName *string `hcl:"kms-key-name"`

S5CipherEngineGCP handles necessary configuration for a 'gcp' s5 cipher engine

type S5CipherEnginePGP

type S5CipherEnginePGP struct {
	PublicKeyPath  *string `hcl:"public-key-path"`
	PrivateKeyPath *string `hcl:"private-key-path"`

S5CipherEnginePGP handles necessary configuration for a 'pgp' s5 cipher engine

type S5CipherEngineType

type S5CipherEngineType string

S5CipherEngineType represents a S5 cipher engine type

const (
	// S5CipherEngineTypeAES refers to an 'aes' s5 cipher engine type
	S5CipherEngineTypeAES S5CipherEngineType = "aes"

	// S5CipherEngineTypeAWS refers to an 'aws' s5 cipher engine type
	S5CipherEngineTypeAWS S5CipherEngineType = "aws"

	// S5CipherEngineTypeGCP refers to a 'gcp' s5 cipher engine type
	S5CipherEngineTypeGCP S5CipherEngineType = "gcp"

	// S5CipherEngineTypePGP refers to a 'pgp' s5 cipher engine type
	S5CipherEngineTypePGP S5CipherEngineType = "pgp"

	// S5CipherEngineTypeVault refers to a 'vault' s5 cipher engine type
	S5CipherEngineTypeVault S5CipherEngineType = "vault"

type S5CipherEngineVault

type S5CipherEngineVault struct {
	TransitKey *string `hcl:"transit-key"`

S5CipherEngineVault handles necessary configuration for a 'vault' s5 cipher engine

type TFC

type TFC struct {
	Address      *string    `hcl:"address"`
	Token        *string    `hcl:"token"`
	Organization *string    `hcl:"organization"`
	Workspace    *Workspace `hcl:"workspace,block"`

	WorkspaceAutoCreate     *bool `hcl:"workspace-auto-create"`
	PurgeUnmanagedVariables *bool `hcl:"purge-unmanaged-variables"`

TFC handles Terraform Cloud related configuration

type Variable

type Variable struct {
	Name      string  `hcl:"name,label"`
	Vault     *Vault  `hcl:"vault,block"`
	S5        *S5     `hcl:"s5,block"`
	Env       *Env    `hcl:"env,block"`
	Sensitive *bool   `hcl:"sensitive"`
	HCL       *bool   `hcl:"hcl"`
	TTL       *string `hcl:"ttl"`

	Kind  VariableKind
	Value string

Variable is a generic handler of variable characteristics

func (*Variable) GetProvider

func (v *Variable) GetProvider() (*VariableProvider, error)

GetProvider returns the VariableProvider that can be used for processing the variable

type VariableDefaults

type VariableDefaults struct {
	Sensitive *bool   `hcl:"sensitive"`
	HCL       *bool   `hcl:"hcl"`
	TTL       *string `hcl:"ttl"`

VariableDefaults can handle default values for variables

type VariableExpiration

type VariableExpiration struct {
	TTL      time.Duration `json:"ttl"`
	ExpireAt time.Time     `json:"expire_at"`

VariableExpiration contains the Time To Live (TTL) and when the value of a variable to expire is going to expire

type VariableExpirations

type VariableExpirations map[VariableKind]map[string]*VariableExpiration

VariableExpirations holds the expiration times of variables, stored within TFC as a jsonmap within an __TFCW_VARIABLES_EXPIRATIONS environment variable (quite hacky..)

type VariableKind

type VariableKind string

VariableKind represents the kind of variable we want to provision

const (
	// VariableKindTerraform refers to a 'terraform' variable in TFC
	VariableKindTerraform VariableKind = "terraform"

	// VariableKindEnvironment refers to an 'environment' variable in TFC
	VariableKindEnvironment VariableKind = "environment"

type VariableProvider

type VariableProvider string

VariableProvider represent the provider which can be used in order to process the variable

const (
	// VariableProviderEnv refers to the 'env' variable provider
	VariableProviderEnv VariableProvider = "env"

	// VariableProviderS5 refers to the 's5' variable provider
	VariableProviderS5 VariableProvider = "s5"

	// VariableProviderVault refers to the 'vault' variable provider
	VariableProviderVault VariableProvider = "vault"

type VariableWithValue

type VariableWithValue struct {
	Value string

VariableWithValue is a generic handler for found variable values

type Variables

type Variables []*Variable

Variables is a slice of *Variable

type VariablesWithValues

type VariablesWithValues []*VariableWithValue

VariablesWithValues is a slice of *ComputedVariable

type Vault

type Vault struct {
	Address *string            `hcl:"address"`
	Token   *string            `hcl:"token"`
	Method  *string            `hcl:"method"`
	Params  *map[string]string `hcl:"params"`
	Path    *string            `hcl:"path"`
	Key     *string            `hcl:"key"`
	Keys    *map[string]string `hcl:"keys"`
	Values  map[string]string

Vault is a provider type

type Workspace

type Workspace struct {
	Name             *string `hcl:"name"`
	Operations       *bool   `hcl:"operations"`
	AutoApply        *bool   `hcl:"auto-apply"`
	TerraformVersion *string `hcl:"terraform-version"`
	WorkingDirectory *string `hcl:"working-directory"`
	SSHKey           *string `hcl:"ssh-key"`

Workspace is used to refer to and configure the workspace

Jump to

Keyboard shortcuts

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