Documentation
¶
Index ¶
- func ContainsPath(modules []Module, path string) bool
- func DetectAmbiguities(dirPaths []string, namespace string, mappings map[string]string) error
- func FormatTag(modulePath string, version *semver.Version) string
- func GroupTagsByModule(tags []TagInfo) map[string][]TagInfo
- func NextVersion(current *semver.Version, bump string) (*semver.Version, error)
- func RegistryPath(dirPath string, namespace string, mappings map[string]string) (registryPath string, autoMapped bool, err error)
- func SortVersionsAsc(tags []TagInfo)
- func SortVersionsDesc(tags []TagInfo)
- func ValidateRegistryPath(path string) error
- type Module
- type TagInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsPath ¶
ContainsPath reports whether any module in the slice has the given path.
func DetectAmbiguities ¶ added in v0.2.0
DetectAmbiguities checks that no two directory paths produce the same auto-derived registry path. Explicitly mapped paths are excluded.
func GroupTagsByModule ¶
GroupTagsByModule groups parsed tag infos by module path.
func NextVersion ¶
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
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.
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 ¶
FilterTagsForModule filters parsed tags to only those matching a module path.
func LatestVersion ¶
LatestVersion returns the latest version from a list of tag infos. Returns nil if the list is empty.
func ParseAllTags ¶
ParseAllTags parses a list of raw tag strings, skipping those that don't match the expected format.
func ParseTag ¶
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
EffectiveRegistryPath returns RegistryPath if set, otherwise falls back to ModulePath.