File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
package gitlab
2
2
3
3
import (
4
+ "fmt"
5
+ "strings"
6
+
4
7
"github.com/hashicorp/terraform/helper/schema"
5
8
"github.com/hashicorp/terraform/terraform"
6
9
)
@@ -18,10 +21,11 @@ func Provider() terraform.ResourceProvider {
18
21
Description : descriptions ["token" ],
19
22
},
20
23
"base_url" : {
21
- Type : schema .TypeString ,
22
- Optional : true ,
23
- DefaultFunc : schema .EnvDefaultFunc ("GITLAB_BASE_URL" , "" ),
24
- Description : descriptions ["base_url" ],
24
+ Type : schema .TypeString ,
25
+ Optional : true ,
26
+ DefaultFunc : schema .EnvDefaultFunc ("GITLAB_BASE_URL" , "" ),
27
+ Description : descriptions ["base_url" ],
28
+ ValidateFunc : validateApiURLVersion ,
25
29
},
26
30
"cacert_file" : {
27
31
Type : schema .TypeString ,
@@ -71,3 +75,11 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
71
75
72
76
return config .Client ()
73
77
}
78
+
79
+ func validateApiURLVersion (value interface {}, key string ) (ws []string , es []error ) {
80
+ v := value .(string )
81
+ if strings .HasSuffix (v , "/api/v3" ) || strings .HasSuffix (v , "/api/v3/" ) {
82
+ es = append (es , fmt .Errorf ("terraform-gitlab-provider does not support v3 api; please upgrade to /api/v4 in %s" , v ))
83
+ }
84
+ return
85
+ }
You can’t perform that action at this time.
0 commit comments