Skip to content

Commit

Permalink
fixed import on google_tags_tag_binding (#9054)
Browse files Browse the repository at this point in the history
* fixed import on google_tags_tag_binding

* added d.setid()

---------

Co-authored-by: Edward Sun <[email protected]>
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician and Edward Sun committed Sep 26, 2023
1 parent ff66584 commit 7d41465
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/9054.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
tags: fixed import failure on `google_tags_tag_binding`
```
8 changes: 8 additions & 0 deletions google-beta/services/tags/resource_tags_tag_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ func resourceTagsTagBindingImport(d *schema.ResourceData, meta interface{}) ([]*
return nil, err
}

stringParts := strings.Split(d.Get("name").(string), "/")
if len(stringParts) < 3 {
return nil, fmt.Errorf("Error parsing parent name. Should be in form {{parent}}/tagValues/{{tag_value}}")
}
if err := d.Set("parent", stringParts[0]); err != nil {
return nil, fmt.Errorf("Error setting parent, %s", err)
}

name := d.Get("name").(string)
d.SetId(name)

Expand Down

0 comments on commit 7d41465

Please sign in to comment.