cli: spinner for planning Terraform migrations (#2533)

* Remove mention of "changes below" for changes that are listed above the message
* Add a spinner for Terraform Plan action

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-10-30 09:19:35 +01:00 committed by GitHub
parent 78c5d09ae7
commit e4d8bda792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -71,13 +71,15 @@ func (a *applyCmd) planTerraformMigration(cmd *cobra.Command, conf *config.Confi
// u.upgrader.AddManualStateMigration(migration) // u.upgrader.AddManualStateMigration(migration)
// } // }
return a.clusterUpgrader.PlanClusterUpgrade(cmd.Context(), cmd.OutOrStdout(), vars, conf.GetProvider()) a.spinner.Start("Checking for infrastructure changes", false)
defer a.spinner.Stop()
return a.clusterUpgrader.PlanClusterUpgrade(cmd.Context(), a.spinner, vars, conf.GetProvider())
} }
// migrateTerraform migrates an existing Terraform state and the post-migration infrastructure state is returned. // migrateTerraform migrates an existing Terraform state and the post-migration infrastructure state is returned.
func (a *applyCmd) migrateTerraform(cmd *cobra.Command, conf *config.Config, upgradeDir string) (state.Infrastructure, error) { func (a *applyCmd) migrateTerraform(cmd *cobra.Command, conf *config.Config, upgradeDir string) (state.Infrastructure, error) {
// Ask for confirmation first // Ask for confirmation first
fmt.Fprintln(cmd.OutOrStdout(), "The upgrade requires a migration of Constellation cloud resources by applying an updated Terraform template. Please manually review the suggested changes below.") cmd.Println("The upgrade requires a migration of Constellation cloud resources by applying an updated Terraform template.")
if !a.flags.yes { if !a.flags.yes {
ok, err := askToConfirm(cmd, "Do you want to apply the Terraform migrations?") ok, err := askToConfirm(cmd, "Do you want to apply the Terraform migrations?")
if err != nil { if err != nil {

View File

@ -288,4 +288,3 @@ data "azurerm_user_assigned_identity" "uaid" {
name = local.uai_name name = local.uai_name
resource_group_name = local.uai_resource_group resource_group_name = local.uai_resource_group
} }