config

package
v0.0.0-...-6477f42 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

Default config

As there is a terraform-validator.yaml file at the root of your terraform module, terraform-validator will merge the default and your ustom configuration before running.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArgs

func ParseArgs(version string) string

ParseArgs get the path given as os argument

Types

type ConfigurationLayer

type ConfigurationLayer struct {
	Files                     map[string]FileConfig `yaml:"files"`
	EnsureTerraformVersion    bool                  `yaml:"ensure_terraform_version"`
	EnsureProvidersVersion    bool                  `yaml:"ensure_providers_version"`
	EnsureVariablesDescrition bool                  `yaml:"ensure_variables_description"`
	EnsureOutputsDescrition   bool                  `yaml:"ensure_outputs_description"`
	BlockPatternName          string                `yaml:"block_pattern_name"`
}

ConfigurationLayer is a type that define a layer of config for a folder.

func DefaultConfigurationLayer

func DefaultConfigurationLayer() ConfigurationLayer

DefaultConfigurationLayer return you the default ConfigurationLayer

func (ConfigurationLayer) GetAuthorizedBlocks

func (configLayer ConfigurationLayer) GetAuthorizedBlocks(filename string) ([]string, error)

GetAuthorizedBlocks gets you the authorized blocks for the given filename. If the filename is not configure it gets you the dfault configuration. If their is no default either, return you an error.

func (ConfigurationLayer) GetMandatoryFiles

func (configLayer ConfigurationLayer) GetMandatoryFiles() []string

GetMandatoryFiles get the mandatory file list from the globalConfig

type FileConfig

type FileConfig struct {
	AuthorizedBlocks []string `yaml:"authorized_blocks"`
	Mandatory        bool     `yaml:"mandatory"`
}

FileConfig is the configuration for a .tf file AuthorizedBlocks is the list of authorized blocks in that file (for example "variables", "output"...). Mandatory is a boolean that define if the file is mandatory or not.

type TfvConfig

type TfvConfig struct {
	CurrentLayer string
	Layers       map[string]ConfigurationLayer
}

TfvConfig is the full configuration of terraform validator CurrentLayer is the current folder applied layer Layers is a map of ConfigurationLayer

func DefaultTfvConfig

func DefaultTfvConfig() TfvConfig

DefaultTfvConfig returns you the default TfvConfig

func (TfvConfig) GetConfigurationLayer

func (c TfvConfig) GetConfigurationLayer() ConfigurationLayer

GetConfigurationLayer get the applied ConfigurationLayer

func (TfvConfig) GetTerraformConfig

func (c TfvConfig) GetTerraformConfig(workDir string) TfvConfig

GetTerraformConfig get the terraform-validator config. If .terraform-validator.yaml exists it merge the default and the custom config

func (*TfvConfig) UnmarshalYAML

func (c *TfvConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is a custom yaml unmarshaller for TerraformConfig

Jump to

Keyboard shortcuts

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