mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-22 07:50:04 -05:00
cli: re-introduce iam upgrade check
This commit is contained in:
parent
99a81cd246
commit
248dfa2563
@ -368,7 +368,7 @@ func (a *applyCmd) apply(
|
|||||||
// Check current Terraform state, if it exists and infrastructure upgrades are not skipped,
|
// Check current Terraform state, if it exists and infrastructure upgrades are not skipped,
|
||||||
// and apply migrations if necessary.
|
// and apply migrations if necessary.
|
||||||
if !a.flags.skipPhases.contains(skipInfrastructurePhase) {
|
if !a.flags.skipPhases.contains(skipInfrastructurePhase) {
|
||||||
if err := a.runTerraformApply(cmd, conf, stateFile, upgradeDir); err != nil {
|
if err := a.runTerraformApply(cmd, conf, stateFile, upgradeDir, a.flags.yes); err != nil {
|
||||||
return fmt.Errorf("applying Terraform configuration: %w", err)
|
return fmt.Errorf("applying Terraform configuration: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// runTerraformApply checks if changes to Terraform are required and applies them.
|
// runTerraformApply checks if changes to Terraform are required and applies them.
|
||||||
func (a *applyCmd) runTerraformApply(cmd *cobra.Command, conf *config.Config, stateFile *state.State, upgradeDir string) error {
|
func (a *applyCmd) runTerraformApply(cmd *cobra.Command, conf *config.Config, stateFile *state.State, upgradeDir string, yesFlag bool) error {
|
||||||
a.log.Debug("Checking if Terraform migrations are required")
|
a.log.Debug("Checking if Terraform migrations are required")
|
||||||
terraformClient, removeClient, err := a.newInfraApplier(cmd.Context())
|
terraformClient, removeClient, err := a.newInfraApplier(cmd.Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -36,6 +36,20 @@ func (a *applyCmd) runTerraformApply(cmd *cobra.Command, conf *config.Config, st
|
|||||||
return fmt.Errorf("checking if Terraform workspace is empty: %w", err)
|
return fmt.Errorf("checking if Terraform workspace is empty: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !isNewCluster && 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 !yesFlag {
|
||||||
|
yes, err := askToConfirm(cmd, "Did you upgrade the IAM resources?")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("asking for confirmation: %w", err)
|
||||||
|
}
|
||||||
|
if !yes {
|
||||||
|
cmd.Println("Skipping upgrade.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if changesRequired, err := a.planTerraformChanges(cmd, conf, terraformClient); err != nil {
|
if changesRequired, err := a.planTerraformChanges(cmd, conf, terraformClient); err != nil {
|
||||||
return fmt.Errorf("planning Terraform migrations: %w", err)
|
return fmt.Errorf("planning Terraform migrations: %w", err)
|
||||||
} else if !changesRequired {
|
} else if !changesRequired {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user