v2

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReservedVariableNames = map[string]bool{
	"aws_accounts": true,
	"aws_profile":  true,
	"env":          true,
	"owner":        true,
	"project":      true,
	"region":       true,
	"tags":         true,
}

Functions

func AWSProviderAccountIdGetter added in v0.21.0

func AWSProviderAccountIdGetter(comm Common) *json.Number

func AWSProviderAdditionalRegionsGetter added in v0.21.0

func AWSProviderAdditionalRegionsGetter(comm Common) []string

func AWSProviderProfileGetter added in v0.21.0

func AWSProviderProfileGetter(comm Common) *string

func AWSProviderRegionGetter added in v0.21.0

func AWSProviderRegionGetter(comm Common) *string

func AWSProviderVersionGetter added in v0.21.0

func AWSProviderVersionGetter(comm Common) *string

func BackendAccountIdGetter added in v0.24.0

func BackendAccountIdGetter(comm Common) *string

func BackendBucketGetter added in v0.21.0

func BackendBucketGetter(comm Common) *string

func BackendDynamoTableGetter added in v0.21.0

func BackendDynamoTableGetter(comm Common) *string

func BackendProfileGetter added in v0.21.0

func BackendProfileGetter(comm Common) *string

func BackendRegionGetter added in v0.21.0

func BackendRegionGetter(comm Common) *string

func BlessProviderAdditionalRegionsGetter added in v0.22.0

func BlessProviderAdditionalRegionsGetter(comm Common) []string

func BlessProviderProfileGetter added in v0.22.0

func BlessProviderProfileGetter(comm Common) *string

func BlessProviderRegionGetter added in v0.22.0

func BlessProviderRegionGetter(comm Common) *string

func BlessProviderVersionGetter added in v0.22.0

func BlessProviderVersionGetter(comm Common) *string

func CircleCIRoleNameGetter added in v0.35.0

func CircleCIRoleNameGetter(comm Common) *string

func CircleCISSHFingerprintsGetter added in v0.35.0

func CircleCISSHFingerprintsGetter(comm Common) []string

func ExtraVarsGetter added in v0.21.0

func ExtraVarsGetter(comm Common) map[string]string

func GitHubActionsRoleNameGetter added in v0.40.0

func GitHubActionsRoleNameGetter(comm Common) *string

func GithubProviderBaseURLGetter added in v0.30.0

func GithubProviderBaseURLGetter(comm Common) *string

func GithubProviderOrganizationGetter added in v0.30.0

func GithubProviderOrganizationGetter(comm Common) *string

func GithubProviderVersionGetter added in v0.30.0

func GithubProviderVersionGetter(comm Common) *string

func OktaProviderOrgNameGetter added in v0.23.0

func OktaProviderOrgNameGetter(comm Common) *string

func OktaProviderVersionGetter added in v0.23.0

func OktaProviderVersionGetter(comm Common) *string

func OwnerGetter added in v0.21.0

func OwnerGetter(comm Common) *string

func ProjectGetter added in v0.21.0

func ProjectGetter(comm Common) *string

func ResolveModuleTerraformVersion added in v0.21.0

func ResolveModuleTerraformVersion(def Defaults, module Module) *string

func ResolveOptionalString added in v0.21.0

func ResolveOptionalString(getter func(Common) *string, commons ...Common) *string

func ResolveOptionalStringSlice added in v0.21.0

func ResolveOptionalStringSlice(getter func(Common) []string, commons ...Common) []string

func ResolveRequiredInt64 added in v0.21.0

func ResolveRequiredInt64(getter func(Common) *int64, commons ...Common) int64

ResolveRequiredInt will resolve the value and panic if it is nil. Only to be used after validations are run.

func ResolveRequiredString added in v0.21.0

func ResolveRequiredString(getter func(Common) *string, commons ...Common) string

ResolveRequiredString will resolve the value and panic if it is nil. Only to be used after validations are run.

func ResolveStringArray added in v0.21.0

func ResolveStringArray(def []string, override []string) []string

func ResolveStringMap added in v0.21.0

func ResolveStringMap(getter func(Common) map[string]string, commons ...Common) map[string]string

func SnowflakeProviderAccountGetter added in v0.21.0

func SnowflakeProviderAccountGetter(comm Common) *string

func SnowflakeProviderRegionGetter added in v0.21.0

func SnowflakeProviderRegionGetter(comm Common) *string

func SnowflakeProviderRoleGetter added in v0.21.0

func SnowflakeProviderRoleGetter(comm Common) *string

func SnowflakeProviderVersionGetter added in v0.22.0

func SnowflakeProviderVersionGetter(comm Common) *string

func TerraformVersionGetter added in v0.21.0

func TerraformVersionGetter(comm Common) *string

func TravisRoleNameGetter added in v0.25.0

func TravisRoleNameGetter(comm Common) *string

func ValidateAWSProvider added in v0.21.0

func ValidateAWSProvider(p *AWSProvider, component string) error

Types

type AWSProvider

type AWSProvider struct {
	// the aws provider is optional (above) but if supplied you must set account id and region
	AccountID         *json.Number `json:"account_id,omitempty" yaml:"account_id,omitempty"`
	AdditionalRegions []string     `json:"additional_regions,omitempty" yaml:"additional_regions,omitempty"`
	Profile           *string      `json:"profile,omitempty" yaml:"profile,omitempty"`
	Region            *string      `json:"region,omitempty" yaml:"region,omitempty"`
	Version           *string      `json:"version,omitempty" yaml:"version,omitempty"`
}

func ResolveAWSProvider added in v0.21.0

func ResolveAWSProvider(commons ...Common) *AWSProvider

ResolveAWSProvider will return an AWSProvder iff one of the required fields is set somewhere in the set of Common config objects passed in. Otherwise it will return nil.

type Account

type Account struct {
	Common `json:",inline" yaml:",inline"`
}

type Backend

type Backend struct {
	Type        *string `json:"type,omitempty" yaml:"type,omitempty" validate:"omitempty,oneof=s3"`
	AccountID   *string `json:"account_id,omitempty" yaml:"account_id,omitempty"`
	Bucket      *string `json:"bucket,omitempty" yaml:"bucket,omitempty"`
	DynamoTable *string `json:"dynamodb_table,omitempty" yaml:"dynamodb_table,omitempty"`
	Profile     *string `json:"profile,omitempty" yaml:"profile,omitempty"`
	Region      *string `json:"region,omitempty" yaml:"region,omitempty"`
}

Backend is used to configure a terraform backend

type BlessProvider added in v0.22.0

type BlessProvider struct {
	// the bless provider is optional (above) but if supplied you must set a region and aws_profile
	AdditionalRegions []string `json:"additional_regions,omitempty" yaml:"additional_regions,omitempty"`
	AWSProfile        *string  `json:"aws_profile,omitempty" yaml:"aws_profile,omitempty"`
	AWSRegion         *string  `json:"aws_region,omitempty" yaml:"aws_region,omitempty"`
	Version           *string  `json:"version,omitempty" yaml:"version,omitempty"`
}

BlessProvider allows for terraform-provider-bless configuration

func ResolveBlessProvider added in v0.22.0

func ResolveBlessProvider(commons ...Common) *BlessProvider

func (*BlessProvider) Validate added in v0.23.0

func (p *BlessProvider) Validate(component string) error

type CIProviderConfig added in v0.41.0

type CIProviderConfig struct {
	Disabled bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
}

type CircleCI added in v0.35.0

type CircleCI struct {
	CommonCI `json:",inline" yaml:",inline"`

	SSHKeyFingerprints []string `json:"ssh_key_fingerprints" yaml:"ssh_key_fingerprints"`
}

func ResolveCircleCI added in v0.35.0

func ResolveCircleCI(commons ...Common) *CircleCI

type Common

type Common struct {
	Backend          *Backend          `json:"backend,omitempty" yaml:"backend,omitempty"`
	ExtraVars        map[string]string `json:"extra_vars,omitempty" yaml:"extra_vars,omitempty"`
	Owner            *string           `json:"owner,omitempty" yaml:"owner,omitempty"`
	Project          *string           `json:"project,omitempty" yaml:"project,omitempty"`
	Providers        *Providers        `json:"providers,omitempty" yaml:"providers,omitempty"`
	TerraformVersion *string           `json:"terraform_version,omitempty" yaml:"terraform_version,omitempty"`
	Tools            *Tools            `json:"tools,omitempty" yaml:"tools,omitempty"`
}

type CommonCI added in v0.41.0

type CommonCI struct {
	Enabled        *bool                       `json:"enabled,omitempty" yaml:"enabled,omitempty"`
	AWSIAMRoleName *string                     `json:"aws_iam_role_name" yaml:"aws_iam_role_name,omitempty"`
	TestBuckets    *int                        `json:"test_buckets" yaml:"test_buckets,omitempty"`
	Command        *string                     `json:"command,omitempty" yaml:"command,omitempty"`
	Buildevents    *bool                       `json:"buildevents,omitempty" yaml:"buildevents,omitempty"`
	Providers      map[string]CIProviderConfig `json:"providers,omitempty" yaml:"providers,omitempty"`
}

type Component

type Component struct {
	Common `json:",inline" yaml:",inline"`

	EKS          *EKSConfig     `json:"eks,omitempty" yaml:"eks,omitempty"`
	Kind         *ComponentKind `json:"kind,omitempty" yaml:"kind,omitempty"`
	ModuleSource *string        `json:"module_source,omitempty" yaml:"module_source,omitempty"`
}

type ComponentKind added in v0.41.0

type ComponentKind string

ComponentKind is the kind of this component

const (
	// DefaultComponentKind defaults to terraform component
	DefaultComponentKind ComponentKind = "terraform"
	// ComponentKindTerraform is a terraform component
	ComponentKindTerraform = DefaultComponentKind
	// ComponentKindHelmTemplate is a helm template component
	ComponentKindHelmTemplate ComponentKind = "helm_template"
)

func (*ComponentKind) GetOrDefault added in v0.41.0

func (ck *ComponentKind) GetOrDefault() ComponentKind

GetOrDefault gets the component kind or default

type Config

type Config struct {
	Accounts map[string]Account `json:"accounts,omitempty" yaml:"accounts,omitempty"`
	Defaults Defaults           `json:"defaults" yaml:"defaults" validate:"required"`
	Docker   bool               `json:"docker,omitempty" yaml:"docker,omitempty"`
	Envs     map[string]Env     `json:"envs,omitempty" yaml:"envs,omitempty"`
	Global   Component          `json:"global,omitempty" yaml:"global,omitempty"`
	Modules  map[string]Module  `json:"modules,omitempty" yaml:"modules,omitempty"`
	Plugins  Plugins            `json:"plugins,omitempty" yaml:"plugins,omitempty"`
	Version  int                `json:"version,omitempty" yaml:"version,omitempty" validate:"required,eq=2"`
}

func ReadConfig

func ReadConfig(fs afero.Fs, b []byte, configFile string) (*Config, error)

ReadConfig take a byte array as input and outputs a json or yaml config struct

func (*Config) Generate

func (c *Config) Generate(r *rand.Rand, size int) reflect.Value

Generate is used for test/quick integration. There are supposedly ways to do this without polluting the public api, but givent that fogg isn't an api, it doesn't seem like a big deal

func (*Config) Validate

func (c *Config) Validate() ([]string, error)

Validate validates the config

func (*Config) ValidateAWSProviders added in v0.21.0

func (c *Config) ValidateAWSProviders() error

func (*Config) ValidateBlessProviders added in v0.22.0

func (c *Config) ValidateBlessProviders() error

func (*Config) ValidateOktaProviders added in v0.23.0

func (c *Config) ValidateOktaProviders() error

func (*Config) ValidateSnowflakeProviders added in v0.21.0

func (c *Config) ValidateSnowflakeProviders() error

func (*Config) ValidateToolsTfLint added in v0.23.0

func (c *Config) ValidateToolsTfLint() ([]string, error)

func (*Config) ValidateTravis added in v0.25.0

func (c *Config) ValidateTravis() error

func (*Config) WalkComponents added in v0.21.0

func (c *Config) WalkComponents(f func(component string, commons ...Common))

type DatadogProvider added in v0.40.0

type DatadogProvider struct{}

func ResolveDatadogProvider added in v0.40.0

func ResolveDatadogProvider(commons ...Common) *DatadogProvider

type Defaults

type Defaults struct {
	Common `json:",inline" yaml:",inline"`
}

type EKSConfig added in v0.41.0

type EKSConfig struct {
	ClusterName string `json:"cluster_name" yaml:"cluster_name"`
}

EKSConfig is the configuration for an eks cluster

type Env

type Env struct {
	Common `json:",inline" yaml:",inline"`

	Components map[string]Component `json:"components,omitempty" yaml:"components,omitempty"`
}

type GitHubActionsCI added in v0.40.0

type GitHubActionsCI struct {
	CommonCI `json:",inline" yaml:",inline"`
}

func ResolveGitHubActionsCI added in v0.40.0

func ResolveGitHubActionsCI(commons ...Common) *GitHubActionsCI

type GithubProvider added in v0.30.0

type GithubProvider struct {
	Organization *string `json:"organization,omitempty" yaml:"organization,omitempty"`
	BaseURL      *string `json:"base_url,omitempty" yaml:"base_url,omitempty"`
	Version      *string `json:"version,omitempty" yaml:"version,omitempty"`
}

func ResolveGithubProvider added in v0.30.0

func ResolveGithubProvider(commons ...Common) *GithubProvider

ResolveGithubProvider will return an GithubProvder iff one of the required fields is set somewhere in the set of Common config objects passed in. Otherwise it will return nil.

type HerokuProvider added in v0.37.0

type HerokuProvider struct{}

func ResolveHerokuProvider added in v0.37.0

func ResolveHerokuProvider(commons ...Common) *HerokuProvider

type Module added in v0.41.0

type Module struct {
	TerraformVersion *string `json:"terraform_version,omitempty" yaml:"terraform_version,omitempty"`
}

Module is a module

type OktaProvider added in v0.23.0

type OktaProvider struct {
	// the okta provider is optional (above) but if supplied you must set an OrgName
	OrgName *string `json:"org_name,omitempty" yaml:"org_name,omitempty"`
	Version *string `json:"version,omitempty" yaml:"version,omitempty"`
}

OktaProvider is an okta provider

func ResolveOktaProvider added in v0.23.0

func ResolveOktaProvider(commons ...Common) *OktaProvider

func (*OktaProvider) Validate added in v0.23.0

func (o *OktaProvider) Validate(component string) error

type Plugins added in v0.41.0

type Plugins struct {
	CustomPlugins      map[string]*plugins.CustomPlugin `json:"custom_plugins,omitempty" yaml:"custom_plugins,omitempty"`
	TerraformProviders map[string]*plugins.CustomPlugin `json:"terraform_providers,omitempty" yaml:"terraform_providers,omitempty"`
}

Plugins contains configuration around plugins

type Providers

type Providers struct {
	AWS       *AWSProvider       `json:"aws,omitempty" yaml:"aws,omitempty"`
	Bless     *BlessProvider     `json:"bless,omitempty" yaml:"bless,omitempty"`
	Github    *GithubProvider    `json:"github,omitempty" yaml:"github,omitempty"`
	Heroku    *HerokuProvider    `json:"heroku,omitempty" yaml:"heroku,omitempty"`
	Okta      *OktaProvider      `json:"okta,omitempty" yaml:"okta,omitempty"`
	Snowflake *SnowflakeProvider `json:"snowflake,omitempty" yaml:"snowflake,omitempty"`
	Datadog   *DatadogProvider   `json:"datadog,omitempty" yaml:"datadog,omitempty"`
}

type SnowflakeProvider added in v0.21.0

type SnowflakeProvider struct {
	Account *string `json:"account,omitempty" yaml:"account,omitempty"`
	Role    *string `json:"role,omitempty" yaml:"role,omitempty"`
	Region  *string `json:"region,omitempty" yaml:"region,omitempty"`
	Version *string `json:"version,omitempty" yaml:"version,omitempty"`
}

func ResolveSnowflakeProvider added in v0.21.0

func ResolveSnowflakeProvider(commons ...Common) *SnowflakeProvider

func (*SnowflakeProvider) Validate added in v0.23.0

func (p *SnowflakeProvider) Validate(component string) error

type TfLint added in v0.41.0

type TfLint struct {
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
}

func ResolveTfLint added in v0.23.0

func ResolveTfLint(commons ...Common) TfLint

type Tools

type Tools struct {
	TravisCI        *TravisCI        `json:"travis_ci,omitempty" yaml:"travis_ci,omitempty"`
	CircleCI        *CircleCI        `json:"circle_ci,omitempty" yaml:"circle_ci,omitempty"`
	GitHubActionsCI *GitHubActionsCI `json:"github_actions_ci,omitempty" yaml:"github_actions_ci,omitempty"`
	TfLint          *TfLint          `json:"tflint,omitempty" yaml:"tflint,omitempty"`
}

type TravisCI added in v0.41.0

type TravisCI struct {
	CommonCI `json:",inline" yaml:",inline"`
}

func ResolveTravis added in v0.25.0

func ResolveTravis(commons ...Common) *TravisCI

Jump to

Keyboard shortcuts

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