Skip to content

Commit

Permalink
DXCDT-538: Adding progress spinner to tf generate command (#838)
Browse files Browse the repository at this point in the history
Adding progress spinners

Co-authored-by: Will Vedder <[email protected]>
  • Loading branch information
willvedd and willvedd authored Sep 11, 2023
1 parent da61765 commit c39fabf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/cli/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/hashicorp/terraform-exec/tfexec"
"github.com/spf13/cobra"

"github.com/auth0/auth0-cli/internal/ansi"
"github.com/auth0/auth0-cli/internal/auth0"
"github.com/auth0/auth0-cli/internal/prompt"
)
Expand Down Expand Up @@ -144,7 +145,11 @@ func generateTerraformCmdRun(cli *cli, inputs *terraformInputs) func(cmd *cobra.
return err
}

data, err := fetchImportData(cmd.Context(), resources...)
var data importDataList
err = ansi.Spinner("Fetching data from Auth0", func() error {
data, err = fetchImportData(cmd.Context(), resources...)
return err
})
if err != nil {
return err
}
Expand All @@ -162,7 +167,11 @@ func generateTerraformCmdRun(cli *cli, inputs *terraformInputs) func(cmd *cobra.
}

if terraformProviderCredentialsAreAvailable() {
if err := generateTerraformResourceConfig(cmd.Context(), inputs.OutputDIR); err == nil {
err = ansi.Spinner("Generating Terraform configuration", func() error {
return generateTerraformResourceConfig(cmd.Context(), inputs.OutputDIR)
})

if err == nil {
cli.renderer.Infof("Terraform resource config files generated successfully in: %q", inputs.OutputDIR)
cli.renderer.Infof(
"Review the config and generate the terraform state by running: \n\n cd %s && ./terraform apply",
Expand Down

0 comments on commit c39fabf

Please sign in to comment.