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

Consider removing exported error types #296

Closed
kmoe opened this issue Apr 26, 2022 · 1 comment · Fixed by #352
Closed

Consider removing exported error types #296

kmoe opened this issue Apr 26, 2022 · 1 comment · Fixed by #352
Assignees
Milestone

Comments

@kmoe
Copy link
Member

kmoe commented Apr 26, 2022

The tfexec exported error types - for example, tfexec.ErrCLIUsage and tfexec.ErrTFVersionMismatch - are implemented by parsing Terraform's human-readable error output using regular expressions.

Since this log output is subject to frequent changes and not covered by the v1.0 compatibility promises, users of these error types are at risk of having their code broken by new Terraform versions, requiring them (in the best case) to keep terraform-exec updated.

This error parsing code also seems to be a leading cause of terraform-exec nightly test failures.

Are these error types useful enough to consumers to continue maintaining them? Should we remove them prior to v1.0.0? Are there any really good use cases?

@kmoe kmoe added this to the v1.0.0 milestone Apr 26, 2022
@kmoe kmoe self-assigned this Jan 10, 2023
@bflad
Copy link
Contributor

bflad commented Jan 12, 2023

To gain some insight on potential usage in the wild, I spent some time with GitHub's code search (fuzzy matching on tfexec.{TYPE} because it'd be difficult to ignore non-tfexec things and most Go code doesn't use aliasing), e.g.

Error Type External GitHub Repo Usage Code Search URL
ErrConfigInvalid 1 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrConfigInvalid%22
ErrLockIdInvalid 0 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrLockIdInvalid%22
ErrMissingVar 2 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrMissingVar%22
ErrNoConfig 1 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrNoConfig%22
ErrNoInit 1 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrNoInit%22
ErrNoWorkspace 3 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrNoWorkspace%22
ErrStateLocked 1 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrStateLocked%22
ErrStatePlanRead 0 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrStatePlanRead%22
ErrTFVersionMismatch 0 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrTFVersionMismatch%22
ErrWorkspaceExists 2 https://cs.github.com/?scopeName=All+repos&scope=&q=language%3Ago+%22tfexec.ErrWorkspaceExists%22

What I found was:

I personally think that these removals are okay given the maintenance burden.

@kmoe kmoe closed this as completed in #352 Feb 20, 2023
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 a pull request may close this issue.

2 participants