cli: fix upgrade by passing placeholder values for images (#2250)

Co-authored-by: Leonard Cohnen <lc@edgeless.systems>
This commit is contained in:
Adrian Stobbe 2023-08-17 07:16:09 +02:00 committed by GitHub
parent 587ae6a575
commit ca47d26634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,17 +19,21 @@ import (
// TerraformUpgradeVars returns variables required to execute the Terraform scripts.
func TerraformUpgradeVars(conf *config.Config) (terraform.Variables, error) {
// Note that we pass "" as imageRef, as we ignore changes to the image in the terraform.
// Note that we don't pass any real image as imageRef, as we ignore changes to the image in the terraform.
// The image is updates via our operator.
// Still, the terraform variable verification must accept the values.
// For AWS, we enforce some basic constraints on the image variable.
// For Azure, the provider enforces the format below.
// For GCP, any placeholder works.
switch conf.GetProvider() {
case cloudprovider.AWS:
vars := awsTerraformVars(conf, "")
vars := awsTerraformVars(conf, "ami-placeholder")
return vars, nil
case cloudprovider.Azure:
vars := azureTerraformVars(conf, "")
vars := azureTerraformVars(conf, "/communityGalleries/myGalleryName/images/myImageName/versions/latest")
return vars, nil
case cloudprovider.GCP:
vars := gcpTerraformVars(conf, "")
vars := gcpTerraformVars(conf, "placeholder")
return vars, nil
default:
return nil, fmt.Errorf("unsupported provider: %s", conf.GetProvider())