You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**token** (String, Sensitive) The secret token. This is only populated when creating a new deploy token.
62
+
-**token** (String, Sensitive) The secret token. This is only populated when creating a new deploy token.**Note**: The token is not available for imported resources.
63
63
64
+
## Import
64
65
66
+
Import is supported using the following syntax:
67
+
68
+
```shell
69
+
# GitLab deploy tokens can be imported using an id made up of `{type}:{type_id}:{deploy_token_id}`, where type is one of: project, group.
Description: "The secret token. This is only populated when creating a new deploy token.",
86
+
Description: "The secret token. This is only populated when creating a new deploy token. **Note**: The token is not available for imported resources.",
84
87
Type: schema.TypeString,
85
88
Computed: true,
86
89
Sensitive: true,
@@ -257,3 +260,25 @@ func resourceGitlabDeployTokenDelete(ctx context.Context, d *schema.ResourceData
returnnil, fmt.Errorf("Invalid Deploy Token import format; expected '{type}:{type_id}:{deploy_token_id}' where the type can either be a group or project")
269
+
}
270
+
271
+
tokenType, typeID, id:=s[0], s[1], s[2]
272
+
273
+
d.SetId(id)
274
+
switchtokenType {
275
+
case"project":
276
+
d.Set("project", typeID)
277
+
case"group":
278
+
d.Set("group", typeID)
279
+
default:
280
+
d.SetId("")
281
+
returnnil, fmt.Errorf("Invalid Deploy Token import format; expected '{type}:{type_id}:{deploy_token_id}' where the type can either be a group or project")
0 commit comments