module

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsPath

func ContainsPath(modules []Module, path string) bool

ContainsPath reports whether any module in the slice has the given path.

func DetectAmbiguities added in v0.2.0

func DetectAmbiguities(dirPaths []string, namespace string, mappings map[string]string) error

DetectAmbiguities checks that no two directory paths produce the same auto-derived registry path. Explicitly mapped paths are excluded.

func FormatTag

func FormatTag(modulePath string, version *semver.Version) string

FormatTag creates a tag string from a module path and version.

func GroupTagsByModule

func GroupTagsByModule(tags []TagInfo) map[string][]TagInfo

GroupTagsByModule groups parsed tag infos by module path.

func NextVersion

func NextVersion(current *semver.Version, bump string) (*semver.Version, error)

NextVersion computes the next version given a bump type.

func RegistryPath added in v0.2.0

func RegistryPath(dirPath string, namespace string, mappings map[string]string) (registryPath string, autoMapped bool, err error)

RegistryPath converts a directory path to a 3-segment registry path (namespace/name/system) as required by the Terraform registry protocol.

If a mapping exists for dirPath, it is used (autoMapped=false). Otherwise the path is derived as: namespace/{parts[1:] joined with -}/{parts[0]}. The first directory segment is treated as the provider/system, the rest form the name.

func SortVersionsAsc

func SortVersionsAsc(tags []TagInfo)

SortVersionsAsc sorts tag infos by version ascending (oldest first).

func SortVersionsDesc

func SortVersionsDesc(tags []TagInfo)

SortVersionsDesc sorts tag infos by version descending (newest first).

func ValidateRegistryPath added in v0.2.0

func ValidateRegistryPath(path string) error

ValidateRegistryPath checks that a path has exactly 3 non-empty segments.

Types

type Module

type Module struct {
	Path string // Relative path within the repo, e.g. "hetzner/server"
}

Module represents a discovered terraform module.

func DiscoverModules

func DiscoverModules(repoPath string, excludeDirs ...string) ([]Module, error)

DiscoverModules walks the repository directory and finds all directories containing .tf files (excluding the root directory). Any directories in excludeDirs are skipped (matched by name, not path).

type TagInfo

type TagInfo struct {
	Tag          string
	ModulePath   string // Directory path in the repo (e.g. "hetzner/server")
	RegistryPath string // 3-segment path for the registry protocol (e.g. "hetzner/server/hetzner")
	Version      *semver.Version
}

TagInfo holds parsed information from a git tag.

func FilterTagsForModule

func FilterTagsForModule(tags []TagInfo, modulePath string) []TagInfo

FilterTagsForModule filters parsed tags to only those matching a module path.

func LatestVersion

func LatestVersion(tags []TagInfo) *TagInfo

LatestVersion returns the latest version from a list of tag infos. Returns nil if the list is empty.

func ParseAllTags

func ParseAllTags(rawTags []string) []TagInfo

ParseAllTags parses a list of raw tag strings, skipping those that don't match the expected format.

func ParseTag

func ParseTag(tag string) (*TagInfo, error)

ParseTag parses a git tag into module path and version. Tags have the format: {module_path}-{semver} We scan from the right for a '-' followed by a valid semver to handle module paths containing dashes (e.g. aws/ec2/security-group-1.0.0).

func (TagInfo) EffectiveRegistryPath added in v0.2.0

func (t TagInfo) EffectiveRegistryPath() string

EffectiveRegistryPath returns RegistryPath if set, otherwise falls back to ModulePath.

Jump to

Keyboard shortcuts

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