diff --git a/pkg/cmd/roachprod/main.go b/pkg/cmd/roachprod/main.go index 7c6fe1ca0a56..840f76d26259 100644 --- a/pkg/cmd/roachprod/main.go +++ b/pkg/cmd/roachprod/main.go @@ -1395,6 +1395,18 @@ func validateAndConfigure(cmd *cobra.Command, args []string) { _ = cmd.Flags().Set("arch", string(arch)) } } + + // Validate cloud providers, if set. + providersSet := make(map[string]struct{}) + for _, p := range createVMOpts.VMProviders { + if _, ok := vm.Providers[p]; !ok { + printErrAndExit(fmt.Errorf("unknown cloud provider %q", p)) + } + if _, ok := providersSet[p]; ok { + printErrAndExit(fmt.Errorf("duplicate cloud provider specified %q", p)) + } + providersSet[p] = struct{}{} + } } var updateCmd = &cobra.Command{