Skip to content

Commit

Permalink
Add back section ID update
Browse files Browse the repository at this point in the history
  • Loading branch information
williamhpark committed Oct 17, 2023
1 parent 6567fb0 commit 3977adf
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions onepassword/resource_onepassword_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,19 +546,17 @@ func dataToItem(data *schema.ResourceData) (*onepassword.Item, error) {
if !ok {
return nil, fmt.Errorf("Unable to parse section: %v", sections[i])
}
sid, err := uuid.GenerateUUID()
if err != nil {
return nil, fmt.Errorf("Unable to generate a section id: %w", err)
}

if section["id"].(string) != "" {
sid = section["id"].(string)
} else {
if section["id"].(string) == "" {
sid, err := uuid.GenerateUUID()
if err != nil {
return nil, fmt.Errorf("Unable to generate a section id: %w", err)
}
section["id"] = sid
}

s := &onepassword.ItemSection{
ID: sid,
ID: section["id"].(string),
Label: section["label"].(string),
}
item.Sections = append(item.Sections, s)
Expand Down

0 comments on commit 3977adf

Please sign in to comment.