Skip to content

Commit 4ed6931

Browse files
fix: datacatalog taxonomy import project from name (#7137) (#5145)
* fix: datacatalog taxonomy import project from name * fix: indentation on region instance group manager test * Revert "fix: indentation on region instance group manager test" This reverts commit 4ec92c31f14a5d15e5b897413f74908e51ba88d5. --------- Signed-off-by: ekapratama93 <[email protected]> Signed-off-by: Modular Magician <[email protected]>
1 parent 8e94376 commit 4ed6931

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changelog/7137.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
datacatalog: fixed the import failure when the `project` is different from the default on `google_data_catalog_taxonomy`
3+
```

google-beta/resource_data_catalog_taxonomy.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"fmt"
1919
"log"
2020
"reflect"
21+
"regexp"
2122
"strings"
2223
"time"
2324

@@ -332,6 +333,12 @@ func resourceDataCatalogTaxonomyImport(d *schema.ResourceData, meta interface{})
332333
name := d.Get("name").(string)
333334
d.SetId(name)
334335

336+
re := regexp.MustCompile("projects/(.+)/(?:locations|regions)/(.+)/taxonomies/(.+)")
337+
if matches := re.FindStringSubmatch(name); matches != nil {
338+
d.Set("project", matches[1])
339+
d.Set("region", matches[2])
340+
}
341+
335342
return []*schema.ResourceData{d}, nil
336343
}
337344

0 commit comments

Comments
 (0)