Documentation
¶
Index ¶
- Constants
- func ConfigPath(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) string
- func DefaultArgs() []string
- func Execute(ctx context.Context, runtime *Runtime, info *schema.ConfigAndStacksInfo, ...) error
- func ResolveArgs(args []string, atmosConfig *schema.AtmosConfiguration, ...) []string
- func Run(ctx context.Context, opts *Options) (*scanners.Output, *scanners.Context, error)
- type AffectedOptions
- type Options
- type Runtime
Constants ¶
const ( Name = "tflint" Command = "tflint" OutputFormatMarkdown = "markdown" OutputFormatRich = "rich" )
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶
func ConfigPath(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) string
ConfigPath finds the applicable TFLint configuration. The closest config wins: the component directory, then the Terraform components base path, then the repository root. This lets shared components override project-wide rules.
func DefaultArgs ¶
func DefaultArgs() []string
DefaultArgs returns tflint's default CLI arguments. TFLint 0.47+ dropped support for positional [FILE or DIR...] arguments ("Command line arguments support was dropped in v0.47. Use --chdir or --filter instead."), so $ATMOS_COMPONENT_PATH must be passed via --chdir rather than positionally.
func Execute ¶
func Execute(ctx context.Context, runtime *Runtime, info *schema.ConfigAndStacksInfo, affected *AffectedOptions, maxFindings int) error
Execute runs the Terraform-aware TFLint command. When affected is non-nil, it selects changed Terraform components; otherwise it selects the requested component or every Terraform component. The maxFindings argument caps how many individual findings are shown per component (0 uses sarif's own default); see cmd/terraform/lint.go's --max-findings flag.
func ResolveArgs ¶
func ResolveArgs(args []string, atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) []string
ResolveArgs adds TFLint's configuration file when the caller did not explicitly provide one. Config discovery uses the closest standard location: component directory, Terraform components base path, then repository root. The project-level components.terraform.lint.config setting is a final fallback.
Types ¶
type AffectedOptions ¶
type AffectedOptions struct {
CloneTargetRef bool
ExcludeLocked bool
IncludeSettings bool
RepoPath string
Ref string
SHA string
SSHKeyPath string
SSHKeyPassword string
Stack string
TargetBranch string
ProcessTemplates bool
ProcessYamlFunctions bool
Skip []string
AuthDisabled bool
// ErrorMode is the raw --error-mode flag/env value ("", "strict", "warn", or "silent").
// Resolved against atmos.yaml's components.terraform.lint.error_mode (then "warn") by
// the Runtime.AffectedComponents implementation, not by this package — see
// cmd/terraform/lint.go's resolveTerraformLintAffectedComponents.
ErrorMode string
}
AffectedOptions contains the affected-component inputs accepted by the Terraform lint command. It deliberately belongs to this package so callers do not need to expose internal/exec command arguments.
type Options ¶
type Options struct {
Args []string
Env map[string]string
BaseEnv []string
OnFailure string
AtmosConfig *schema.AtmosConfiguration
Info *schema.ConfigAndStacksInfo
ToolchainPATH string
// MaxFindings caps how many individual findings appear in the table per
// component (0 uses sarif's own default of 10). See cmd/terraform/lint.go's
// --max-findings flag.
MaxFindings int
// OutputFormat controls Atmos's presentation of findings. TFLint still
// always receives --format=sarif so artifacts and CI reports stay stable.
OutputFormat string
}
type Runtime ¶
type Runtime struct {
SetupAuth func(*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) (auth.AuthManager, error)
DescribeStacks func(
*schema.AtmosConfiguration,
string,
[]string,
[]string,
[]string,
bool,
bool,
bool,
bool,
[]string,
auth.AuthManager,
bool,
) (map[string]any, error)
ProcessStacks func(
*schema.AtmosConfiguration,
schema.ConfigAndStacksInfo,
bool,
bool,
bool,
[]string,
auth.AuthManager,
) (schema.ConfigAndStacksInfo, error)
AffectedComponents func(*schema.AtmosConfiguration, *AffectedOptions, auth.AuthManager) ([]schema.Affected, error)
// OutputFormat selects the terminal-only presentation for this command.
OutputFormat string
}
Runtime supplies the existing stack and affected-component operations needed to prepare a component for linting. Keeping these adapters at the command boundary lets this reusable scanner package remain independent of internal/exec (which already depends on workflow steps that use TFLint).