Package hcl provides parsing functionality for Terramate HCL configuration. It also provides printing and formatting for Terramate configuration.
const ( ErrScriptNoLabels errors.Kind = "terramate schema error: (script): must provide at least one label" ErrScriptRedeclared errors.Kind = "terramate schema error: (script): multiple script blocks with same labels in the same directory" ErrScriptUnrecognizedAttr errors.Kind = "terramate schema error: (script): unrecognized attribute" ErrScriptJobUnrecognizedAttr errors.Kind = "terramate schema error: (script.job): unrecognized attribute" ErrScriptUnrecognizedBlock errors.Kind = "terramate schema error: (script): unrecognized block" ErrScriptNoCmds errors.Kind = "terramate schema error: (script): missing command or commands" ErrScriptMissingOrInvalidJob errors.Kind = "terramate schema error: (script): missing or invalid job" ErrScriptCmdConflict errors.Kind = "terramate schema error: (script): conflicting attribute already set" )
Errors returned during the HCL parsing of script block
Errors returned during the HCL parsing.
View Sourceconst SharingIsCaringExperimentName = "outputs-sharing"
SharingIsCaringExperimentName is the name of the outputs-sharing experiment.
This section is empty.
MatchAnyGlob is a helper function to test if s matches any of the given patterns.
PrintConfig will print the given config as HCL on the given writer.
PrintImports will print the given imports list as import blocks.
ValueAsStringList will convert the given cty.Value to a string list.
type AssertBlockParser struct { }
AssertBlockParser is the parser for the "assert" block.
NewCustomAssertBlockParser returns a new parser specification for the scoped "assert" blocks.
NewTopLevelAssertBlockParser returns a new parser specification for the top-level "assert" block.
Name returns the type of the block.
Parse parses the "assert" block.
type AssertConfig struct { Range info.Range Warning hcl.Expression Assertion hcl.Expression Message hcl.Expression }
AssertConfig represents Terramate assert configuration block.
ChangeDetectionConfig is the `terramate.config.change_detection` config.
CloudConfig represents Terramate cloud configuration.
type Command ¶ added in v0.4.4Command represents an executable command
func NewScriptCommand ¶ added in v0.4.4NewScriptCommand returns a *Command encapsulating an ast.Attribute
type Commands ¶ added in v0.4.4Commands represents a list of executable commands
func NewScriptCommands ¶ added in v0.4.4NewScriptCommands returns *Commands encapsulating an ast.Attribute
Config represents a Terramate configuration.
NewConfig creates a new HCL config with dir as config directory path.
ParseDir will parse Terramate configuration from a given directory, using root as project workspace, parsing all files with the suffixes .tm and .tm.hcl. It parses in non-strict mode for compatibility with older versions. Note: it does not recurse into child directories.
AbsDir returns the absolute path of the configuration directory.
Experiments returns the config enabled experiments, if any.
HasGlobals tells if the configuration has any globals defined.
HasRunEnv returns true if the config has a terramate.config.run.env block defined
IsEmpty returns true if the config is empty, false otherwise.
IsRootConfig tells if the Config is a root configuration.
Save the configuration file using filename inside config directory.
Evaluator represents a Terramate evaluator
GenFileBlock represents a parsed generate_file block
GenHCLBlock represents a parsed generate_hcl block.
GenerateConfig includes code generation related configurations, like generate_file and generate_hcl.
type GenerateFileBlockParser struct{}
GenerateFileBlockParser is the parser for the "generate_file" block.
NewGenerateFileBlockParser returns a new parser specification for the "generate_file" block.
Name returns the type of the block.
Parse parses the "generate_file" block.
type GenerateHCLBlockParser struct{}
GenerateHCLBlockParser is the parser for the "generate_hcl" block.
Name returns the type of the block.
Parse parses the "generate_hcl" block.
type GenerateRootConfig struct { }
GenerateRootConfig represents the AST node for the `terramate.config.generate` block.
type GitChangeDetectionConfig struct { Untracked *bool Uncommitted *bool }
GitChangeDetectionConfig is the `terramate.config.change_detection.git` config.
GitConfig represents Terramate Git configuration.
NewGitConfig creates a git configuration with proper default values.
type GlobalsBlockParser struct{}
GlobalsBlockParser is the parser for the globals block.
NewGlobalsBlockParser creates a new globals block parser.
Name returns the name of the block.
Parse parses the globals block.
type Input struct { info.Range Name string Backend hcl.Expression FromStackID hcl.Expression Value hcl.Expression Sensitive hcl.Expression Mock hcl.Expression }
Input holds the parsed values for the `input` block.
type InputBlockParser struct{}
InputBlockParser is the parser for the "input" block.
NewInputBlockParser returns a new parser specification for the "input" block.
Name returns the type of the block.
Parse parses the "input" block.
Inputs is a list of Input blocks.
ManifestConfig represents the manifest config block of a Terramate configuration.
type ManifestDesc struct { Files []string Excludes []string }
ManifestDesc represents a parsed manifest description.
type MergedBlockHandler ¶ added in v0.13.1MergedBlockHandler specifies how a merged block should be parsed.
type MergedLabelsBlockHandler ¶ added in v0.13.1MergedLabelsBlockHandler specifies how a merged block with labels should be parsed.
Option is a function that can be used to configure a TerramateParser.
WithExperiments is an option to set the experiments to be enabled in the parser.
func WithMergedBlockHandlers ¶ added in v0.13.1WithMergedBlockHandlers is an option to set the merged block specifications for the parser.
func WithMergedLabelsBlockHandlers ¶ added in v0.13.1WithMergedLabelsBlockHandlers is an option to set the merged labels block specifications for the parser.
WithStrictMode is an option to enable strict mode in the parser.
func WithUniqueBlockHandlers ¶ added in v0.13.1WithUniqueBlockHandlers is an option to set the unique block specifications for the parser.
func WithUnmergedBlockHandlers ¶ added in v0.13.1WithUnmergedBlockHandlers is an option to set the unmerged block specifications for the parser.
OptionalCheck is a bool that can also have no configured value.
ToOptionalCheck creates an OptionalCheck value from a bool.
ValueOr returns if an OptionalCheck is enabled, or the given default if its unset.
type Output struct { info.Range Name string Backend hcl.Expression Description hcl.Expression Value hcl.Expression Sensitive hcl.Expression }
Output holds the parsed value for the `output` block.
type OutputBlockParser struct{}
OutputBlockParser is the specification for the output block.
NewOutputBlockParser returns a new parser specification for the "output" block.
Name returns the type of the block.
Parse parses the "output" block.
Outputs is a list of Output blocks.
RawConfig is the configuration (attributes and blocks) without schema validations.
NewCustomRawConfig returns a new customized RawConfig.
NewTopLevelRawConfig returns a new RawConfig object tailored for the Terramate top-level attributes and blocks.
Copy cfg into a new RawConfig
Merge the config with the provided other config.
RootConfig represents the root config block of a Terramate configuration.
HasSafeguardDisabled checks if the configuration (including the deprecated) has the given keyword disabled.
type RunConfig struct { CheckGenCode bool Env *RunEnv }
RunConfig represents Terramate run configuration.
NewRunConfig creates a new run configuration.
RunEnv represents Terramate run environment.
Script represents a parsed script block
AccessorName returns the name traversal for accessing the script.
type ScriptBlockParser struct{}
ScriptBlockParser is a parser for the "script" block
NewScriptBlockParser returns a new parser specification for the "script" block.
Name returns the type of the block.
Parse parses the "script" block.
ScriptJob represent a Job within a Script
SharingBackend holds the parsed values for the `sharing_backend` block.
type SharingBackendBlockParser struct{}
SharingBackendBlockParser is the parser for the "sharing_backend" block.
NewSharingBackendBlockParser returns a new parser specification for the "sharing_backend" block.
Name returns the type of the block.
Parse parses the "outputs_sharing" block.
type SharingBackendType int
SharingBackendType is the type of the sharing backend.
These are the valid sharing_backend types.
SharingBackends is a list of SharingBackend blocks.
Stack is the parsed "stack" HCL block.
type StackBlockSpec struct { }
StackBlockSpec is the specification for the stack block.
NewStackBlockParser returns a new parser specification for the "stack" block.
Name returns the name of the block.
Parse parses the "stack" block.
type StackFilterConfig struct { ProjectPaths []glob.Glob RepositoryPaths []glob.Glob }
StackFilterConfig represents Terramate stack_filter configuration block.
type TargetsConfig struct { Enabled bool }
TargetsConfig represents Terramate targets configuration.
type TelemetryConfig struct { Enabled *bool }
TelemetryConfig represents Terramate telemetry configuration.
TerragruntChangeDetectionConfig is the `terramate.config.change_detection.terragrunt` config.
type TerragruntChangeDetectionEnabledOption int
TerragruntChangeDetectionEnabledOption is the change detection options for enabling Terragrunt.
Terragrunt Enabling options.
type Terramate struct { RequiredVersion string RequiredVersionAllowPreReleases bool Config *RootConfig }
Terramate is the parsed "terramate" HCL block.
type TerramateBlockParser struct{}
TerramateBlockParser is the parser for the "terramate" block.
NewTerramateBlockParser returns a new parser specification for the "terramate" block.
Name returns the type of the block.
Parse parses the "terramate" block.
TerramateParser is an HCL parser tailored for Terramate configuration schema. As the Terramate configuration can span multiple files in the same directory, this API allows you to define the exact set of files (and contents) that are going to be included in the final configuration.
NewTerramateParser creates a Terramate parser for the directory dir inside the root directory. The parser creates sub-parsers for parsing imports but keeps a list of all parsed files of all sub-parsers for detecting cycles and import duplications. The subparsers inherits this parser options.
AddDir walks over all the files in the directory dir and add all .tm and .tm.hcl files to the parser.
AddFile adds a file path to be parsed.
AddFileContent adds a file to the set of files to be parsed.
Imports returns all import blocks.
IsRootConfig parses rootdir and tells if it contains a root config or not. Note: after identifying this is the config you need, then call ParseConfig() to retrieve the full config.
ParseConfig parses and checks the schema of previously added files and return either a Config or an error.
ParseHCL does the syntax parsing, applying imports and merging of configurations but do not validate if the HCL schema is a valid Terramate configuration.
ParsedBodies returns a map of filename to the parsed hclsyntax.Body.
type UniqueBlockHandler ¶ added in v0.13.1UniqueBlockHandler specifies how a unique block should be parsed.
type UnmergedBlockHandler ¶ added in v0.13.1UnmergedBlockHandler specifies how the block should be parsed.
NewGenerateHCLBlockParser returns a new parser specification for the "generate_hcl" block.
type UnmergedBlockHandlerConstructor ¶ added in v0.13.1UnmergedBlockHandlerConstructor is a constructor for an unmerged block handler.
DefaultUnmergedBlockParsers returns the default unmerged block specifications for the parser.
type VendorBlockParser struct{}
VendorBlockParser is the parser for the "vendor" block.
NewVendorBlockParser returns a new parser specification for the "vendor" block.
Name returns the type of the block.
Parse parses the "vendor" block.
VendorConfig is the parsed "vendor" HCL block.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4