Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to update network nameservers #280

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions civo/network/resource_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,21 @@ func resourceNetworkUpdate(ctx context.Context, d *schema.ResourceData, m interf
log.Printf("[INFO] updating the network %s", d.Id())
_, err := apiClient.RenameNetwork(d.Get("label").(string), d.Id())
if err != nil {
return diag.Errorf("[ERR] An error occurred while rename the network %s", d.Id())
return diag.Errorf("[ERR] An error occurred while renaming the network %s", d.Id())
}
}

networkConfig := civogo.NetworkConfig{
Region: apiClient.Region,
NameserversV4: expandStringList(d.Get("nameservers_v4")),
}

if d.HasChange("nameservers_v4") {
log.Printf("[INFO] updating the network nameservers %s", d.Id())
_, err := apiClient.UpdateNetwork(d.Id(), networkConfig)
if err != nil {
return diag.Errorf("[ERR] An error occurred while updating the nameservers for the network %s: %s", d.Id(), err)
}
return resourceNetworkRead(ctx, d, m)
}
return resourceNetworkRead(ctx, d, m)
}
Expand Down
Loading