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

Error handling should be reviewed in resourceXXXRead() functions #65

Closed
maksym-nazarenko opened this issue Jun 3, 2022 · 1 comment · Fixed by #66
Closed

Error handling should be reviewed in resourceXXXRead() functions #65

maksym-nazarenko opened this issue Jun 3, 2022 · 1 comment · Fixed by #66

Comments

@maksym-nazarenko
Copy link
Collaborator

maksym-nazarenko commented Jun 3, 2022

This issue was revealed while debugging #63

When some resources are read by Terraform, in case of error the id is set to "" (empty string) which is okay in case of Resource not found - it means that Terraform should remove it from its state.
But in case of another kind of error, e.g. Invalid credentials or Host not found, it should not be the case.

The DnsRecord handles it properly:

if _, ok := err.(*client.NotFound); ok {
	d.SetId("")
	return nil
}

but, for example, Script and Pool don't:

if err != nil {
	d.SetId("")
	return nil
}

So, in case of wrong credentials, Terraform is trying to delete resources.

It, probably, will be mitigated with #64 , but it is far from even Ready for review state.

@ddelnano
Copy link
Owner

ddelnano commented Jun 6, 2022

The fix will be included in v0.9.1.

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