diff --git a/pkg/ctl/create/nodegroup.go b/pkg/ctl/create/nodegroup.go index fc32358ac6..83b47381fe 100644 --- a/pkg/ctl/create/nodegroup.go +++ b/pkg/ctl/create/nodegroup.go @@ -111,6 +111,16 @@ func doCreateNodeGroups(p *api.ProviderConfig, cfg *api.ClusterConfig, nameArg s } meta = cfg.Metadata + if meta.Name == "" { + return fmt.Errorf("metadata.name must be set") + } + + if meta.Region == "" { + return fmt.Errorf("metadata.region must be set") + } + + p.Region = meta.Region + // Limit nodegroups to set specified on command line via globs if err := filterNodeGroups(cfg); err != nil { return err @@ -149,16 +159,6 @@ func doCreateNodeGroups(p *api.ProviderConfig, cfg *api.ClusterConfig, nameArg s } } - if meta.Name == "" { - return fmt.Errorf("metadata.name must be set") - } - - if meta.Region == "" { - return fmt.Errorf("metadata.region must be set") - } - - p.Region = meta.Region - if err := checkEachNodeGroup(cfg, newNodeGroupChecker); err != nil { return err }