From f9be8c00985ab726643a52b54cb0c6725272b9e1 Mon Sep 17 00:00:00 2001 From: Marko Bevc Date: Thu, 10 Oct 2024 14:39:12 +0100 Subject: [PATCH] feat: Confirm before resetting LZ --- pkg/lz/landingzone.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/lz/landingzone.go b/pkg/lz/landingzone.go index 2cbcbb7..12322e3 100644 --- a/pkg/lz/landingzone.go +++ b/pkg/lz/landingzone.go @@ -249,6 +249,7 @@ func formatPath(path []string) string { } func ResetLandingZone(ctx context.Context, cfg aws.Config) { + var lzArn string // CT client ct := controltower.NewFromConfig(cfg) @@ -258,7 +259,14 @@ func ResetLandingZone(ctx context.Context, cfg aws.Config) { log.Fatalf("failed to list landing zones, %v", e) } - lzArn := "" + // Check for confirmation + color.HiYellow("**WARNING**") + c := util.AskForConfirmation(fmt.Sprintf("Are you sure you want to reset your LZ?")) + + if !c { + return + } + if len(res.LandingZones) > 0 { lzArn = aws.ToString(res.LandingZones[0].Arn) fmt.Printf("Found Landing Zone with ARN: %s\n", lzArn)