move csp logic to cloudcmd (#2311)

This commit is contained in:
Adrian Stobbe 2023-09-07 12:10:36 +02:00 committed by GitHub
parent 25ba8ecfed
commit 0eb9ca2e18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -19,6 +19,14 @@ import (
"github.com/edgelesssys/constellation/v2/internal/file"
)
// UpgradeRequiresIAMMigration returns true if the given cloud provider requires an IAM migration.
func UpgradeRequiresIAMMigration(provider cloudprovider.Provider) bool {
switch provider {
default:
return false
}
}
// IAMUpgrader handles upgrades to IAM resources required by Constellation.
type IAMUpgrader struct {
tf tfIAMUpgradeClient

View File

@ -23,13 +23,6 @@ import (
"github.com/spf13/cobra"
)
func upgradeRequiresIAMMigration(provider cloudprovider.Provider) bool {
switch provider {
default:
return false
}
}
func newIAMUpgradeCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "upgrade",

View File

@ -136,7 +136,7 @@ func (u *upgradeApplyCmd) upgradeApply(cmd *cobra.Command, upgradeDir string, fl
if err != nil {
return err
}
if upgradeRequiresIAMMigration(conf.GetProvider()) {
if cloudcmd.UpgradeRequiresIAMMigration(conf.GetProvider()) {
cmd.Println("WARNING: This upgrade requires an IAM migration. Please make sure you have applied the IAM migration using `iam upgrade apply` before continuing.")
if !flags.yes {
yes, err := askToConfirm(cmd, "Did you upgrade the IAM resources?")