@@ -134,7 +134,7 @@ func resourceDocumentAIProcessorCreate(d *schema.ResourceData, meta interface{})
134134 }
135135
136136 // Store the ID now
137- id , err := replaceVars (d , config , "{{name}}" )
137+ id , err := replaceVars (d , config , "projects/{{project}}/locations/{{location}}/processors/ {{name}}" )
138138 if err != nil {
139139 return fmt .Errorf ("Error constructing id: %s" , err )
140140 }
@@ -152,7 +152,7 @@ func resourceDocumentAIProcessorRead(d *schema.ResourceData, meta interface{}) e
152152 return err
153153 }
154154
155- url , err := replaceVars (d , config , "{{DocumentAIBasePath}}{{name}}" )
155+ url , err := replaceVars (d , config , "{{DocumentAIBasePath}}projects/{{project}}/locations/{{location}}/processors/ {{name}}" )
156156 if err != nil {
157157 return err
158158 }
@@ -210,7 +210,7 @@ func resourceDocumentAIProcessorDelete(d *schema.ResourceData, meta interface{})
210210 }
211211 billingProject = project
212212
213- url , err := replaceVars (d , config , "{{DocumentAIBasePath}}{{name}}" )
213+ url , err := replaceVars (d , config , "{{DocumentAIBasePath}}projects/{{project}}/locations/{{location}}/processors/ {{name}}" )
214214 if err != nil {
215215 return err
216216 }
@@ -235,13 +235,15 @@ func resourceDocumentAIProcessorDelete(d *schema.ResourceData, meta interface{})
235235func resourceDocumentAIProcessorImport (d * schema.ResourceData , meta interface {}) ([]* schema.ResourceData , error ) {
236236 config := meta .(* Config )
237237 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>[^/]+)" ,
239241 }, d , config ); err != nil {
240242 return nil , err
241243 }
242244
243245 // 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}}" )
245247 if err != nil {
246248 return nil , fmt .Errorf ("Error constructing id: %s" , err )
247249 }
@@ -251,7 +253,10 @@ func resourceDocumentAIProcessorImport(d *schema.ResourceData, meta interface{})
251253}
252254
253255func flattenDocumentAIProcessorName (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
254- return v
256+ if v == nil {
257+ return v
258+ }
259+ return NameFromSelfLinkStateFunc (v )
255260}
256261
257262func flattenDocumentAIProcessorType (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
0 commit comments