Skip to content

Commit

Permalink
Update resource_maas_network_interface_link.go
Browse files Browse the repository at this point in the history
update link fix canonical#4 - issue #277
  • Loading branch information
robertvarjasi authored Sep 14, 2023
1 parent 8a7c82a commit 901033f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions maas/resource_maas_network_interface_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ func resourceNetworkInterfaceLinkCreate(ctx context.Context, d *schema.ResourceD
//find netlink
for _, link := range networkInterface.Links {
if link.Subnet.ID == subnet.ID {
// Save the resource id
d.SetId(fmt.Sprintf("%v", link.ID))
return resourceNetworkInterfaceLinkUpdate(ctx, d, m)
return resourceNetworkInterfaceLinkUpdate(ctx, d, m, link.ID)
}
}

Expand Down Expand Up @@ -136,14 +134,9 @@ func resourceNetworkInterfaceLinkRead(ctx context.Context, d *schema.ResourceDat
return nil
}

func resourceNetworkInterfaceLinkUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
func resourceNetworkInterfaceLinkUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, linkID int) diag.Diagnostics {
client := m.(*client.Client)

// Get params for the update operation
linkID, err := strconv.Atoi(d.Id())
if err != nil {
return diag.FromErr(err)
}
machine, err := getMachine(client, d.Get("machine").(string))
if err != nil {
return diag.FromErr(err)
Expand Down

0 comments on commit 901033f

Please sign in to comment.