v2

package
v0.75.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: MIT Imports: 16 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 BackendAccountIDGetter added in v0.43.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 BackendHostNameGetter added in v0.43.0

func BackendHostNameGetter(comm Common) *string

func BackendKindGetter added in v0.43.0

func BackendKindGetter(comm Common) *string

BackendKindGetter retrieves the Kind for the current common object

func BackendOrganizationGetter added in v0.43.0

func BackendOrganizationGetter(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 BlessProviderRoleArnGetter added in v0.49.0

func BlessProviderRoleArnGetter(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 DatabricksProviderVersionGetter added in v0.58.1

func DatabricksProviderVersionGetter(comm Common) *string

func DatadogProviderVersionGetter added in v0.43.0

func DatadogProviderVersionGetter(comm Common) *string

func DependsOnAccountsGetter added in v0.50.0

func DependsOnAccountsGetter(comm Common) []string

func DependsOnComponentsGetter added in v0.50.0

func DependsOnComponentsGetter(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 HerokuProviderVersionGetter added in v0.43.0

func HerokuProviderVersionGetter(comm Common) *string

func OktaProviderBaseURLGetter added in v0.48.1

func OktaProviderBaseURLGetter(comm Common) *string

func OktaProviderOrgNameGetter added in v0.23.0

func OktaProviderOrgNameGetter(comm Common) *string

func OktaProviderRegistryNamespaceGetter added in v0.58.1

func OktaProviderRegistryNamespaceGetter(comm Common) *string

func OktaProviderRegistryNamespacegetter added in v0.56.0

func OktaProviderRegistryNamespacegetter(comm Common) *string

func OktaProviderVersionGetter added in v0.23.0

func OktaProviderVersionGetter(comm Common) *string

func OpsGenieProviderVersionGetter added in v0.70.0

func OpsGenieProviderVersionGetter(comm Common) *string

func OwnerGetter added in v0.21.0

func OwnerGetter(comm Common) *string

func PagerdutyProviderVersionGetter added in v0.58.0

func PagerdutyProviderVersionGetter(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 SentryProviderBaseURLGetter added in v0.56.0

func SentryProviderBaseURLGetter(comm Common) *string

func SentryProviderVersionGetter added in v0.56.0

func SentryProviderVersionGetter(comm Common) *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

func ValidateBackend added in v0.43.0

func ValidateBackend(backend *Backend, component string) error

ValidateBackend will check the resolved configuration for a backend and return any errors it finds

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 `yaml:"account_id,omitempty"`
	AdditionalRegions []string     `yaml:"additional_regions,omitempty"`
	Profile           *string      `yaml:"profile,omitempty"`
	Region            *string      `yaml:"region,omitempty"`
	Role              *string      `yaml:"role,omitempty"` // FIXME validate format
	Version           *string      `yaml:"version,omitempty"`
	// HACK HACK(el): we can configure additional, aliased, AWS providers for other accounts
	// 								A map of alias_name to provider configuration
	AdditionalProviders map[string]*AWSProvider `yaml:"additional_providers,omitempty"`
}

func ResolveAWSProvider added in v0.21.0

func ResolveAWSProvider(commons ...Common) *AWSProvider

ResolveAWSProvider will return an AWSProvder if 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 `yaml:",inline"`
}

type AssertProvider added in v0.61.0

type AssertProvider struct {
	Version *string `yaml:"version,omitempty"`
}

func ResolveAssertProvider added in v0.61.0

func ResolveAssertProvider(commons ...Common) *AssertProvider

type Auth0Provider added in v0.58.5

type Auth0Provider struct {
	Version *string `yaml:"version,omitempty"`
	Domain  *string `yaml:"domain,omitempty"`
	Source  *string `yaml:"source,omitempty"`
}

Auth0Provider is the terraform provider for the Auth0 service.

func ResolveAuth0Provider added in v0.58.5

func ResolveAuth0Provider(commons ...Common) *Auth0Provider

type Backend

type Backend struct {
	Kind *string `yaml:"kind,omitempty" validate:"omitempty,oneof=s3 remote"`

	// fields used for S3 backend
	AccountID   *string `yaml:"account_id,omitempty"`
	Bucket      *string `yaml:"bucket,omitempty"`
	DynamoTable *string `yaml:"dynamodb_table,omitempty"`
	Profile     *string `yaml:"profile,omitempty"`
	Region      *string `yaml:"region,omitempty"`
	Role        *string `yaml:"role,omitempty"`

	// fields used for remote backend
	HostName     *string `yaml:"host_name,omitempty"`
	Organization *string `yaml:"organization,omitempty"`
}

Backend is used to configure a terraform backend

func ResolveBackend added in v0.43.0

func ResolveBackend(commons ...Common) *Backend

ResolveBackend returns the Backend configuration for a given component, after applying all inheritance rules

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 `yaml:"additional_regions,omitempty"`
	AWSProfile        *string  `yaml:"aws_profile,omitempty"`
	AWSRegion         *string  `yaml:"aws_region,omitempty"`
	RoleArn           *string  `yaml:"role_arn,omitempty"`
	Version           *string  `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 `yaml:"disabled,omitempty"`
}

type CircleCI added in v0.35.0

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

	SSHKeyFingerprints []string `yaml:"ssh_key_fingerprints,omitempty"`
}

func ResolveCircleCI added in v0.35.0

func ResolveCircleCI(commons ...Common) *CircleCI

type Common

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

type CommonCI added in v0.41.0

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

type CommonProvider added in v0.44.0

type CommonProvider struct {
	Enabled *bool   `yaml:"enabled,omitempty"`
	Version *string `yaml:"version,omitempty"`
}

CommonProvider encapsulates common properties across providers TODO refactor other providers to use CommonProvider inline

type Component

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

	EKS          *EKSConfig     `yaml:"eks,omitempty"`
	Kind         *ComponentKind `yaml:"kind,omitempty"`
	ModuleSource *string        `yaml:"module_source,omitempty"`
	ModuleName   *string        `yaml:"module_name,omitempty"`
	Variables    []string       `yaml:"variables,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
)

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 `yaml:"accounts,omitempty"`
	Defaults Defaults           `yaml:"defaults" validate:"required"`
	Envs     map[string]Env     `yaml:"envs,omitempty"`
	Global   Component          `yaml:"global,omitempty"`
	Modules  map[string]Module  `yaml:"modules,omitempty"`
	Plugins  Plugins            `yaml:"plugins,omitempty"`
	Version  int                `validate:"required,eq=2"`
	TFE      *TFE               `yaml:"tfe,omitempty"`
}

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) PathToComponentType added in v0.50.0

func (c Config) PathToComponentType(path string) (componentInfo, error)

PathToComponentType given a path, return information about that component

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) ValidateBackends added in v0.43.0

func (c *Config) ValidateBackends() error

func (*Config) ValidateBlessProviders added in v0.22.0

func (c *Config) ValidateBlessProviders() error

func (*Config) ValidateGithubActionsCI added in v0.51.0

func (c *Config) ValidateGithubActionsCI() 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))

func (*Config) Write added in v0.50.0

func (c *Config) Write(fs afero.Fs, path string) error

type DatabricksProvider added in v0.58.1

type DatabricksProvider struct {
	Version *string `yaml:"version,omitempty"`
}

func ResolveDatabricksProvider added in v0.58.1

func ResolveDatabricksProvider(commons ...Common) *DatabricksProvider

type DatadogProvider added in v0.40.0

type DatadogProvider struct {
	Version *string `yaml:"version,omitempty"`
}

func ResolveDatadogProvider added in v0.40.0

func ResolveDatadogProvider(commons ...Common) *DatadogProvider

type Defaults

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

type DependsOn added in v0.50.0

type DependsOn struct {
	Accounts   []string `yaml:"accounts"`
	Components []string `yaml:"components"`
}

type EKSConfig added in v0.41.0

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

EKSConfig is the configuration for an eks cluster

type Env

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

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

type GitHubActionsCI added in v0.40.0

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

	SSHKeySecrets []string `yaml:"ssh_key_secrets"`
}

func ResolveGitHubActionsCI added in v0.40.0

func ResolveGitHubActionsCI(commons ...Common) *GitHubActionsCI

type GithubProvider added in v0.30.0

type GithubProvider struct {
	Organization *string `yaml:"organization,omitempty"`
	BaseURL      *string `yaml:"base_url,omitempty"`
	Version      *string `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 GrafanaProvider added in v0.57.0

type GrafanaProvider struct {
	CommonProvider `yaml:",inline"`
}

func ResolveGrafanaProvider added in v0.57.0

func ResolveGrafanaProvider(commons ...Common) *GrafanaProvider

type HerokuProvider added in v0.37.0

type HerokuProvider struct {
	Version *string `yaml:"version,omitempty"`
}

func ResolveHerokuProvider added in v0.37.0

func ResolveHerokuProvider(commons ...Common) *HerokuProvider

type KubernetesProvider added in v0.56.0

type KubernetesProvider struct {
	CommonProvider `yaml:",inline"`
}

func ResolveKubernetesProvider added in v0.56.0

func ResolveKubernetesProvider(commons ...Common) *KubernetesProvider

type Module added in v0.41.0

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

Module is a module

type OktaProvider added in v0.23.0

type OktaProvider struct {

	// TODO refactor to get these from CommonProvider
	Version           *string `yaml:"version,omitempty"`
	RegistryNamespace *string `yaml:"registry_namespace"` // for forked providers

	OrgName *string `yaml:"org_name,omitempty"`
	BaseURL *string `yaml:"base_url,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 OpsGenieProvider added in v0.70.0

type OpsGenieProvider struct {
	Version *string `yaml:"version,omitempty"`
}

func ResolveOpsGenieProvider added in v0.70.0

func ResolveOpsGenieProvider(commons ...Common) *OpsGenieProvider

type PagerdutyProvider added in v0.58.0

type PagerdutyProvider struct {
	Version *string `yaml:"version,omitempty"`
}

func ResolvePagerdutyProvider added in v0.58.0

func ResolvePagerdutyProvider(commons ...Common) *PagerdutyProvider

type Plugins added in v0.41.0

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

Plugins contains configuration around plugins

type Providers

type Providers struct {
	Assert     *AssertProvider     `yaml:"assert,omitempty"`
	Auth0      *Auth0Provider      `yaml:"auth0,omitempty"`
	AWS        *AWSProvider        `yaml:"aws,omitempty"`
	Bless      *BlessProvider      `yaml:"bless,omitempty"`
	Databricks *DatabricksProvider `yaml:"databricks,omitempty"`
	Datadog    *DatadogProvider    `yaml:"datadog,omitempty"`
	Github     *GithubProvider     `yaml:"github,omitempty"`
	Grafana    *GrafanaProvider    `yaml:"grafana,omitempty"`
	Heroku     *HerokuProvider     `yaml:"heroku,omitempty"`
	Kubernetes *KubernetesProvider `yaml:"kubernetes,omitempty"`
	Okta       *OktaProvider       `yaml:"okta,omitempty"`
	OpsGenie   *OpsGenieProvider   `yaml:"opsgenie,omitempty"`
	Pagerduty  *PagerdutyProvider  `yaml:"pagerduty,omitempty"`
	Sentry     *SentryProvider     `yaml:"sentry,omitempty"`
	Snowflake  *SnowflakeProvider  `yaml:"snowflake,omitempty"`
	Tfe        *TfeProvider        `yaml:"tfe,omitempty"`
}

type SentryProvider added in v0.56.0

type SentryProvider struct {
	Version *string `yaml:"version,omitempty"`
	BaseURL *string `yaml:"base_url,omitempty"`
}

func ResolveSentryProvider added in v0.56.0

func ResolveSentryProvider(commons ...Common) *SentryProvider

type SnowflakeProvider added in v0.21.0

type SnowflakeProvider struct {
	Account *string `yaml:"account,omitempty"`
	Role    *string `yaml:"role,omitempty"`
	Region  *string `yaml:"region,omitempty"`
	Version *string `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 TFE added in v0.72.0

type TFE struct {
	Component                      `yaml:",inline"`
	ReadTeams                      *[]string `yaml:"read_teams,omitempty"`
	Branch                         *string   `yaml:"branch,omitempty"`
	GithubOrg                      *string   `yaml:"gh_org,omitempty"`
	GithubRepo                     *string   `yaml:"gh_repo,omitempty"`
	TFEOrg                         string    `yaml:"tfe_org,omitempty"`
	SSHKeyName                     *string   `yaml:"ssh_key_name,omitempty"`
	ExcludedGithubRequiredChecks   *[]string `yaml:"excluded_gh_required_checks,omitempty"`
	AdditionalGithubRequiredChecks *[]string `yaml:"additional_gh_required_checks,omitempty"`
}

type TfLint added in v0.41.0

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

func ResolveTfLint added in v0.23.0

func ResolveTfLint(commons ...Common) TfLint

type TfeProvider added in v0.44.0

type TfeProvider struct {
	CommonProvider `yaml:",inline"`

	Hostname *string `yaml:"hostname,omitempty"`
}

func ResolveTfeProvider added in v0.44.0

func ResolveTfeProvider(commons ...Common) *TfeProvider

type Tools

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

type TravisCI added in v0.41.0

type TravisCI struct {
	CommonCI `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