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

fix #234 : prevent resource creation retries if it already exists #241

Closed
wants to merge 1 commit into from

Conversation

Praveen005
Copy link
Contributor

This change addresses the issue of retries in #234 , which was causing the users to wait for a longer time.

Now in a similar event of re-creation of resources with existing names, the user will get an appropriate error message immediately, prompting them to take corrective measure.

Key Changes:

Immediate Error on Duplicate Names: Updated resourceInstanceCreate() in instances/resource_instance.go and resourceNetworkCreate() in network/resource_network.go to perform pre-creation checks. These checks identify existing instances or networks with the same name(hostname/label), resulting in an immediate error message instead of retrying until timeout.

Did I check other resources for similar issues?

Yes, I did check. only Instance and Network resources are being retried upon failing a successful creation.

Copy link
Member

@uzaxirr uzaxirr left a comment

Choose a reason for hiding this comment

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

Closing this wrt #243

Comment on lines +196 to +199
existingInstances, err := apiClient.ListAllInstances()
if err != nil {
return diag.FromErr(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Redundant API call. We could just check for AlreadyExist error from the SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is one extra API call. I get it. Thank you @uzaxirr

@uzaxirr uzaxirr closed this Jun 24, 2024
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.

None yet

2 participants