Skip to content

Commit

Permalink
move csp logic to cloudcmd (#2311)
Browse files Browse the repository at this point in the history
  • Loading branch information
elchead authored Sep 7, 2023
1 parent 25ba8ec commit 0eb9ca2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 8 additions & 0 deletions cli/internal/cloudcmd/iamupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions cli/internal/cmd/iamupgradeapply.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cmd/upgradeapply.go
Original file line number Diff line number Diff line change
Expand Up @@ -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?")
Expand Down

0 comments on commit 0eb9ca2

Please sign in to comment.