@@ -134,7 +134,7 @@ func resourceDocumentAIProcessorCreate(d *schema.ResourceData, meta interface{})
134
134
}
135
135
136
136
// Store the ID now
137
- id , err := replaceVars (d , config , "{{name}}" )
137
+ id , err := replaceVars (d , config , "projects/{{project}}/locations/{{location}}/processors/ {{name}}" )
138
138
if err != nil {
139
139
return fmt .Errorf ("Error constructing id: %s" , err )
140
140
}
@@ -152,7 +152,7 @@ func resourceDocumentAIProcessorRead(d *schema.ResourceData, meta interface{}) e
152
152
return err
153
153
}
154
154
155
- url , err := replaceVars (d , config , "{{DocumentAIBasePath}}{{name}}" )
155
+ url , err := replaceVars (d , config , "{{DocumentAIBasePath}}projects/{{project}}/locations/{{location}}/processors/ {{name}}" )
156
156
if err != nil {
157
157
return err
158
158
}
@@ -210,7 +210,7 @@ func resourceDocumentAIProcessorDelete(d *schema.ResourceData, meta interface{})
210
210
}
211
211
billingProject = project
212
212
213
- url , err := replaceVars (d , config , "{{DocumentAIBasePath}}{{name}}" )
213
+ url , err := replaceVars (d , config , "{{DocumentAIBasePath}}projects/{{project}}/locations/{{location}}/processors/ {{name}}" )
214
214
if err != nil {
215
215
return err
216
216
}
@@ -235,13 +235,15 @@ func resourceDocumentAIProcessorDelete(d *schema.ResourceData, meta interface{})
235
235
func resourceDocumentAIProcessorImport (d * schema.ResourceData , meta interface {}) ([]* schema.ResourceData , error ) {
236
236
config := meta .(* Config )
237
237
if err := parseImportId ([]string {
238
- "(?P<name>.+)" ,
238
+ "projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/processors/(?P<name>[^/]+)" ,
239
+ "(?P<project>[^/]+)/(?P<location>[^/]+)/(?P<name>[^/]+)" ,
240
+ "(?P<location>[^/]+)/(?P<name>[^/]+)" ,
239
241
}, d , config ); err != nil {
240
242
return nil , err
241
243
}
242
244
243
245
// Replace import id for the resource id
244
- id , err := replaceVars (d , config , "{{name}}" )
246
+ id , err := replaceVars (d , config , "projects/{{project}}/locations/{{location}}/processors/ {{name}}" )
245
247
if err != nil {
246
248
return nil , fmt .Errorf ("Error constructing id: %s" , err )
247
249
}
@@ -251,7 +253,10 @@ func resourceDocumentAIProcessorImport(d *schema.ResourceData, meta interface{})
251
253
}
252
254
253
255
func flattenDocumentAIProcessorName (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
254
- return v
256
+ if v == nil {
257
+ return v
258
+ }
259
+ return NameFromSelfLinkStateFunc (v )
255
260
}
256
261
257
262
func flattenDocumentAIProcessorType (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
0 commit comments