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

change in private_ipv4 on instance value requires the replacement #255

Merged
merged 3 commits into from
Jul 16, 2024

Conversation

uzaxirr
Copy link
Member

@uzaxirr uzaxirr commented Jul 15, 2024

fixes: #247
As it is an immutable field via api, an replacement prompt will occur when change in this value is detected.

@uzaxirr uzaxirr self-assigned this Jul 15, 2024
@uzaxirr uzaxirr merged commit c7c3c37 into master Jul 16, 2024
3 checks passed
ip, err := apiClient.FindIP(oldReservedIP.(string))
if err != nil {
if errors.Is(err, civogo.ZeroMatchesError) {
return diag.Errorf("sorry there is no %s IP in your account", oldReservedIP)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to rework and reword this. Something like "Sorry, there is no IP that matches %s in in this network" ?

I suggest "network" rather than account as these are network-specific, right?

if errors.Is(err, civogo.ZeroMatchesError) {
return diag.Errorf("sorry there is no %s IP in your account", oldReservedIP)
} else if errors.Is(err, civogo.MultipleMatchesError) {
return diag.Errorf("sorry we found more than one IP with that value in your account")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to be "Sorry, more than one IP with that value matches this request" or something?

} else if errors.Is(err, civogo.MultipleMatchesError) {
return diag.Errorf("sorry we found more than one IP with that value in your account")
} else {
return diag.Errorf("error finding IP %s: %s", oldReservedIP, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize "error"


_, err = apiClient.UnassignIP(ip.ID, apiClient.Region)
if err != nil {
return diag.Errorf("[ERR] an error occurred while unassigning reserved IP %s from instance %s: %s", ip.ID, instance.ID, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why this one has "[ERR]" as the prefix to the message and some others don't?

if err != nil {
return diag.Errorf("[ERR] an error occurred while unassigning reserved IP %s from instance %s: %s", ip.ID, instance.ID, err)
}
log.Printf("[INFO] unassigned reserved IP %s from the instance %s", oldReservedIP, d.Id())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one - why "[INFO]" when other messages are not always prefaced with a classification like this?

if errors.Is(err, civogo.ZeroMatchesError) {
return diag.Errorf("sorry there is no %s IP in your account", newReservedIP)
} else if errors.Is(err, civogo.MultipleMatchesError) {
return diag.Errorf("sorry we found more than one IP with that value in your account")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment re multiple matches and rewording that

ip, err := apiClient.FindIP(newReservedIP.(string))
if err != nil {
if errors.Is(err, civogo.ZeroMatchesError) {
return diag.Errorf("sorry there is no %s IP in your account", newReservedIP)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize and add comma: "Sorry, there is no IP matching %s in this network" assuming it's network, not account-specific?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Updating private_ipv4 after instance creation does nothing
3 participants