@@ -21,7 +21,7 @@ var _ = registerResource("gitlab_group_ldap_link", func() *schema.Resource {
21
21
ReadContext : resourceGitlabGroupLdapLinkRead ,
22
22
DeleteContext : resourceGitlabGroupLdapLinkDelete ,
23
23
Importer : & schema.ResourceImporter {
24
- State : resourceGitlabGroupLdapLinkImporter ,
24
+ StateContext : resourceGitlabGroupLdapLinkImporter ,
25
25
},
26
26
27
27
Schema : map [string ]* schema.Schema {
@@ -184,10 +184,10 @@ func resourceGitlabGroupLdapLinkDelete(ctx context.Context, d *schema.ResourceDa
184
184
return nil
185
185
}
186
186
187
- func resourceGitlabGroupLdapLinkImporter (ctx context.Context , d * schema.ResourceData , meta interface {}) ([]* schema.ResourceData , diag. Diagnostics ) {
187
+ func resourceGitlabGroupLdapLinkImporter (ctx context.Context , d * schema.ResourceData , meta interface {}) ([]* schema.ResourceData , error ) {
188
188
parts := strings .SplitN (d .Id (), ":" , 3 )
189
189
if len (parts ) != 3 {
190
- return nil , diag . FromErr ( fmt .Errorf ("invalid ldap link import id (should be <group id>:<ldap provider>:<ladp cn>): %s" , d .Id () ))
190
+ return nil , fmt .Errorf ("invalid ldap link import id (should be <group id>:<ldap provider>:<ladp cn>): %s" , d .Id ())
191
191
}
192
192
193
193
groupId , ldapProvider , ldapCN := parts [0 ], parts [1 ], parts [2 ]
@@ -196,5 +196,8 @@ func resourceGitlabGroupLdapLinkImporter(ctx context.Context, d *schema.Resource
196
196
d .Set ("force" , false )
197
197
198
198
diag := resourceGitlabGroupLdapLinkRead (ctx , d , meta )
199
- return []* schema.ResourceData {d }, diag
199
+ if diag .HasError () {
200
+ return nil , fmt .Errorf ("%s" , diag [0 ].Summary )
201
+ }
202
+ return []* schema.ResourceData {d }, nil
200
203
}
0 commit comments