@@ -42,11 +42,7 @@ func resourceGitlabProjectAccessToken() *schema.Resource {
42
42
Type : schema .TypeString ,
43
43
Optional : true ,
44
44
ValidateFunc : func (i interface {}, k string ) (warnings []string , errors []error ) {
45
- v , ok := i .(string )
46
- if ! ok {
47
- errors = append (errors , fmt .Errorf ("expected type of %q to be string" , k ))
48
- return warnings , errors
49
- }
45
+ v := i .(string )
50
46
51
47
if _ , err := time .Parse ("2006-01-02" , v ); err != nil {
52
48
errors = append (errors , fmt .Errorf ("expected %q to be a valid YYYY-MM-DD date, got %q: %+v" , k , i , err ))
@@ -89,7 +85,7 @@ func resourceGitlabProjectAccessTokenCreate(d *schema.ResourceData, meta interfa
89
85
Scopes : * stringSetToStringSlice (d .Get ("scopes" ).(* schema.Set )),
90
86
}
91
87
92
- log .Printf ("[DEBUG] create gitlab ProjectAccessToken %s %s" , * options .Name , options .Scopes )
88
+ log .Printf ("[DEBUG] create gitlab ProjectAccessToken %s %s for project ID %d " , * options .Name , options .Scopes , project )
93
89
94
90
if v , ok := d .GetOk ("expires_at" ); ok {
95
91
parsedExpiresAt , err := time .Parse ("2006-01-02" , v .(string ))
@@ -98,14 +94,16 @@ func resourceGitlabProjectAccessTokenCreate(d *schema.ResourceData, meta interfa
98
94
}
99
95
parsedExpiresAtISOTime := gitlab .ISOTime (parsedExpiresAt )
100
96
options .ExpiresAt = & parsedExpiresAtISOTime
101
- log .Printf ("[DEBUG] create gitlab ProjectAccessToken with expires_at %s" , * options .ExpiresAt )
97
+ log .Printf ("[DEBUG] create gitlab ProjectAccessToken %s with expires_at %s for project ID %d " , * options .Name , * options . ExpiresAt , project )
102
98
}
103
99
104
100
projectAccessToken , _ , err := client .ProjectAccessTokens .CreateProjectAccessToken (project , options )
105
101
if err != nil {
106
102
return err
107
103
}
108
104
105
+ log .Printf ("[DEBUG] created gitlab ProjectAccessToken %d - %s for project ID %d" , projectAccessToken .ID , * options .Name , project )
106
+
109
107
d .SetId (strconv .Itoa (projectAccessToken .ID ))
110
108
d .Set ("token" , projectAccessToken .Token )
111
109
0 commit comments