Skip to content

Commit

Permalink
hashicorp#153 - Use slash as delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslav-svoboda committed Aug 8, 2022
1 parent 67b4dfd commit 2fb1ea5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ad/resource_ad_group_membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func resourceADGroupMembership() *schema.Resource {
}

func resourceADGroupMembershipRead(d *schema.ResourceData, meta interface{}) error {
toks := strings.Split(d.Id(), "_")
toks := strings.Split(d.Id(), "/")

gm, err := winrmhelper.NewGroupMembershipFromHost(meta.(*config.ProviderConf), toks[0])
if err != nil {
Expand Down Expand Up @@ -72,7 +72,7 @@ func resourceADGroupMembershipCreate(d *schema.ResourceData, meta interface{}) e
return fmt.Errorf("while generating UUID to use as unique membership ID: %s", err)
}

id := fmt.Sprintf("%s_%s", gm.GroupGUID, membershipUUID)
id := fmt.Sprintf("%s/%s", gm.GroupGUID, membershipUUID)
d.SetId(id)

return nil
Expand Down
2 changes: 1 addition & 1 deletion ad/resource_ad_group_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func testAccResourceADGroupMembershipExists(resourceName string, expected bool,
return fmt.Errorf("%s resource not found", resourceName)
}

toks := strings.Split(rs.Primary.ID, "_")
toks := strings.Split(rs.Primary.ID, "/")
gm, err := winrmhelper.NewGroupMembershipFromHost(testAccProvider.Meta().(*config.ProviderConf), toks[0])
if err != nil {
if strings.Contains(err.Error(), "ADIdentityNotFoundException") && !expected {
Expand Down
6 changes: 3 additions & 3 deletions docs/resources/group_membership.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ resource ad_group_membership "gm" {
Import is supported using the following syntax:

```shell
# The ID for this resource is the group's UUID plus a random UUID joined
# by an underscore `_`.
$ terraform import ad_group_membership 9CB8219C-31FF-4A85-A7A3-9BCBB6A41D02_E9079B50-95C5-4101-8400-E01CC83CF53B
# The ID for this resource is the group's id or UUID plus a random UUID joined
# by an slash `/`.
$ terraform import ad_group_membership 9CB8219C-31FF-4A85-A7A3-9BCBB6A41D02/E9079B50-95C5-4101-8400-E01CC83CF53B
```

0 comments on commit 2fb1ea5

Please sign in to comment.