diff --git a/cmd/create/oidcprovider/cmd.go b/cmd/create/oidcprovider/cmd.go index 5517dc6c48..b14ac414b6 100644 --- a/cmd/create/oidcprovider/cmd.go +++ b/cmd/create/oidcprovider/cmd.go @@ -189,8 +189,8 @@ func run(cmd *cobra.Command, argv []string) { if !confirm.Prompt(true, confirmPromptMessage) { os.Exit(0) } - if clusterId == "" { - clusterId = cmd.Flag("cluster").Value.String() + if clusterId == "" && clusterKey != "" { + clusterId = r.FetchCluster().ID() } err = createProvider(r, oidcEndpointURL, clusterId, isProgrammaticallyCalled) if err != nil {