mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-22 21:31:14 -05:00
deps: limit Terraform version to FOSS releases (#2241)
* deps: limit Terraform version to FOSS releases * fix: enforce upper version constraint --------- Co-authored-by: Leonard Cohnen <lc@edgeless.systems>
This commit is contained in:
parent
c6819b8d31
commit
587ae6a575
@ -39,7 +39,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
tfVersion = ">= 1.4.6"
|
||||
// Enforce "<1.6.0" to ensure that only MPL licensed Terraform versions are used.
|
||||
tfVersion = ">= 1.4.6, < 1.6.0"
|
||||
terraformVarsFile = "terraform.tfvars"
|
||||
|
||||
// terraformUpgradePlanFile is the file name of the zipfile created by Terraform plan for Constellation upgrades.
|
||||
@ -521,10 +522,19 @@ func GetExecutable(ctx context.Context, workingDir string) (terraform *tfexec.Te
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
downloadVersion := &releases.LatestVersion{
|
||||
constrainedVersions := &releases.Versions{
|
||||
Product: product.Terraform,
|
||||
Constraints: version,
|
||||
}
|
||||
installCandidates, err := constrainedVersions.List(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if len(installCandidates) == 0 {
|
||||
return nil, nil, fmt.Errorf("no Terraform version found for constraint %s", version)
|
||||
}
|
||||
downloadVersion := installCandidates[len(installCandidates)-1]
|
||||
|
||||
localVersion := &fs.Version{
|
||||
Product: product.Terraform,
|
||||
Constraints: version,
|
||||
|
Loading…
Reference in New Issue
Block a user