Documentation
¶
Overview ¶
Package plugin provides plugin discovery and runner implementation for tfbreak. Types and interfaces are imported from github.com/jokarl/tfbreak-plugin-sdk.
Index ¶
- Constants
- type Issue
- type Issues
- type PluginInfo
- type Runner
- func (r *Runner) DecodeRuleConfig(_ string, _ any) error
- func (r *Runner) EmitIssue(rule tflint.Rule, message string, issueRange hcl.Range) error
- func (r *Runner) GetNewModuleContent(schema *hclext.BodySchema, _ *tflint.GetModuleContentOption) (*hclext.BodyContent, error)
- func (r *Runner) GetNewResourceContent(resourceType string, schema *hclext.BodySchema, ...) (*hclext.BodyContent, error)
- func (r *Runner) GetOldModuleContent(schema *hclext.BodySchema, _ *tflint.GetModuleContentOption) (*hclext.BodyContent, error)
- func (r *Runner) GetOldResourceContent(resourceType string, schema *hclext.BodySchema, ...) (*hclext.BodyContent, error)
Constants ¶
const ( // PluginPrefix is the naming convention for tfbreak plugins. PluginPrefix = "tfbreak-ruleset-" // PluginDirEnv is the environment variable for plugin directory. PluginDirEnv = "TFBREAK_PLUGIN_DIR" // LocalPluginDir is the local plugin directory relative to cwd. LocalPluginDir = ".tfbreak.d/plugins" // HomePluginDir is the home directory plugin path. HomePluginDir = ".tfbreak.d/plugins" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Issue ¶
type Issue struct {
// Rule is the rule that emitted the issue.
Rule tflint.Rule
// Message is the issue message.
Message string
// Range is the source location of the issue.
Range hcl.Range
}
Issue represents a finding emitted by a plugin rule.
type PluginInfo ¶
type PluginInfo struct {
// Name is the plugin name without prefix (e.g., "azurerm").
Name string
// Path is the full path to the plugin binary.
Path string
// Enabled indicates whether the plugin is enabled in config.
Enabled bool
}
PluginInfo contains metadata about a discovered plugin.
func Discover ¶
func Discover(cfg *config.Config) ([]PluginInfo, error)
Discover finds plugins from configured paths. Priority: config.PluginDir > TFBREAK_PLUGIN_DIR > ./.tfbreak.d/plugins > ~/.tfbreak.d/plugins
func GetEnabledPlugins ¶
func GetEnabledPlugins(plugins []PluginInfo) []PluginInfo
GetEnabledPlugins returns only enabled plugins from the discovered list.
type Runner ¶
type Runner struct {
// Issues contains all issues emitted during rule execution.
Issues Issues
// contains filtered or unexported fields
}
Runner implements tflint.Runner for providing config access to plugins. This is the host-side implementation that provides old/new configurations to plugin rules during execution.
func NewRunnerFromContent ¶
NewRunnerFromContent creates a Runner by parsing HCL content from string maps. This is useful for testing or when files are provided as strings.
func (*Runner) DecodeRuleConfig ¶
DecodeRuleConfig decodes rule-specific configuration. This is a stub implementation that returns nil (no config). Full implementation will be added when gRPC communication is implemented.
func (*Runner) GetNewModuleContent ¶
func (r *Runner) GetNewModuleContent(schema *hclext.BodySchema, _ *tflint.GetModuleContentOption) (*hclext.BodyContent, error)
GetNewModuleContent retrieves module content from new files.
func (*Runner) GetNewResourceContent ¶
func (r *Runner) GetNewResourceContent(resourceType string, schema *hclext.BodySchema, _ *tflint.GetModuleContentOption) (*hclext.BodyContent, error)
GetNewResourceContent retrieves resources of a specific type from new files.
func (*Runner) GetOldModuleContent ¶
func (r *Runner) GetOldModuleContent(schema *hclext.BodySchema, _ *tflint.GetModuleContentOption) (*hclext.BodyContent, error)
GetOldModuleContent retrieves module content from old files.
func (*Runner) GetOldResourceContent ¶
func (r *Runner) GetOldResourceContent(resourceType string, schema *hclext.BodySchema, _ *tflint.GetModuleContentOption) (*hclext.BodyContent, error)
GetOldResourceContent retrieves resources of a specific type from old files.