@@ -11,6 +11,7 @@ import (
1111 "github.com/pluralsh/plural/pkg/provider/permissions"
1212 "github.com/pluralsh/plural/pkg/utils"
1313 "github.com/pluralsh/polly/algorithms"
14+ "github.com/pluralsh/polly/containers"
1415 v1 "k8s.io/api/core/v1"
1516)
1617
@@ -50,7 +51,10 @@ type Providers struct {
5051 Scaffolds map [string ]string
5152}
5253
53- var providers = Providers {}
54+ var (
55+ providers = Providers {}
56+ filterProviders = containers .ToSet ([]string {"GENERIC" , "KIND" })
57+ )
5458
5559func GetProviderScaffold (provider , version string ) (string , error ) {
5660 if providers .Scaffolds == nil {
@@ -130,17 +134,17 @@ func getAvailableProviders() error {
130134 if providers .AvailableProviders == nil {
131135 client := api .NewClient ()
132136 available , err := client .GetTfProviders ()
133- available = algorithms .Filter (available , func (prov string ) bool { return prov != "GENERIC" })
134- for i := range available {
135- if available [i ] == "GCP" {
136- available [i ] = "google"
137- }
138- available [i ] = strings .ToLower (available [i ])
139- }
140137 if err != nil {
141138 return api .GetErrorResponse (err , "GetTfProviders" )
142139 }
143- providers .AvailableProviders = available
140+
141+ available = containers .ToSet (available ).Difference (filterProviders ).List ()
142+ providers .AvailableProviders = algorithms .Map (available , func (p string ) string {
143+ if p == "GCP" {
144+ return "google"
145+ }
146+ return strings .ToLower (p )
147+ })
144148 }
145149 return nil
146150}
0 commit comments