releases

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package releases manages terraform releases.

Index

Constants

View Source
const (
	DefaultTerraformVersion = "1.6.0"
	LatestVersionString     = "latest"
)

Variables

This section is empty.

Functions

func NewDownloader

func NewDownloader(destdir string) *downloader

NewDownloader constructs a terraform downloader, with destdir set as the parent directory into which the binaries are downloaded. Pass an empty string to use a default.

Types

type Options

type Options struct {
	logr.Logger
	*sql.DB

	TerraformBinDir string // destination directory for terraform binaries
}

type Service

type Service struct {
	logr.Logger
	// contains filtered or unexported fields
}

func NewService

func NewService(opts Options) *Service

func (Service) Download

func (d Service) Download(ctx context.Context, version string, w io.Writer) (string, error)

Download ensures the given version of terraform is available on the local filesystem and returns its path. Thread-safe: if a Download is in-flight and another Download is requested then it'll be made to wait until the former has finished.

func (*Service) GetLatest

func (s *Service) GetLatest(ctx context.Context) (string, time.Time, error)

GetLatest returns the latest terraform version and the time when it was fetched; if it has not yet been fetched then the default version is returned instead along with zero time.

func (*Service) StartLatestChecker

func (s *Service) StartLatestChecker(ctx context.Context)

StartLatestChecker starts the latest checker go routine, checking the Hashicorp API endpoint for a new latest version.

Jump to

Keyboard shortcuts

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