Documentation
¶
Index ¶
- func DetectModuleSourceType(source string) (sourceType, registryScope string)
- func GetProviderFromResourceType(resourceType string) (string, error)
- func IsUnresolved(err error) bool
- func LooksLikeLocalModuleSource(source string) bool
- func ParseTerraformModules(ctx context.Context, fsys vfs.FS, files model.FileMetadatas, numWorkers int) (map[string]ParsedModule, error)
- type ListModuleEntry
- type ModuleAttributesInfo
- type ModuleParseResult
- type ParsedModule
- type RemoteResolver
- type UnresolvedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectModuleSourceType ¶
func GetProviderFromResourceType ¶
GetProviderFromResourceType extracts the provider name from a Terraform resource type. For example: "aws_s3_bucket" → "aws", "azurerm_network_interface" → "azurerm"
func IsUnresolved ¶ added in v1.7.2
func LooksLikeLocalModuleSource ¶
LooksLikeLocalModuleSource uses heuristics to determine if the resolved source string is likely local
func ParseTerraformModules ¶
func ParseTerraformModules(ctx context.Context, fsys vfs.FS, files model.FileMetadatas, numWorkers int) (map[string]ParsedModule, error)
ParseTerraformModules parses HCL content and extracts module source/version. numWorkers: 0 means auto-detect (GOMAXPROCS).
Types ¶
type ListModuleEntry ¶ added in v1.7.2
type ListModuleEntry struct {
Name string `json:"name"`
Source string `json:"source"`
Version string `json:"version,omitempty"`
SourceType string `json:"source_type"`
RegistryScope string `json:"registry_scope,omitempty"`
FileName string `json:"file_name"`
DefLine int `json:"def_line"`
}
ListModuleEntry is the JSON shape emitted by `datadog-iac-scanner list-modules`. Field names are stable integration contracts for hosted scan orchestration.
func ListModuleEntries ¶ added in v1.7.2
func ListModuleEntries(modules map[string]ParsedModule, includeLocal bool) []ListModuleEntry
ListModuleEntries converts parsed modules to list-modules JSON rows.
type ModuleAttributesInfo ¶
type ModuleParseResult ¶
type ModuleParseResult struct {
Index int
Module ParsedModule
Error error
}
type ParsedModule ¶
type ParsedModule struct {
Name string
AbsSource string
Source string
Version string
IsLocal bool
SourceType string // local, git, registry, etc.
RegistryScope string // public, private, or "" (non-registry)
AttributesData map[string]ModuleAttributesInfo
FileName string
DefLine int
}
func ParseAllModuleVariables ¶
func ParseAllModuleVariables( ctx context.Context, fsys vfs.FS, modules map[string]ParsedModule, rootDir string, resolver RemoteResolver, ) ([]ParsedModule, error)
ParseAllModuleVariables resolves modules to disk and fills AttributesData. Resolution failures for individual modules are non-fatal and logged; only a context cancellation returns an error.
type RemoteResolver ¶ added in v1.8.0
type RemoteResolver interface {
Resolve(ctx context.Context, mod *ParsedModule) (localPath string, err error)
}
type UnresolvedError ¶ added in v1.7.2
type UnresolvedError struct {
Reason string
}
func (*UnresolvedError) Error ¶ added in v1.7.2
func (e *UnresolvedError) Error() string