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

Audit error reporting #62

Merged
merged 1 commit into from
Nov 17, 2022
Merged

Audit error reporting #62

merged 1 commit into from
Nov 17, 2022

Conversation

erademacher
Copy link
Contributor

@erademacher erademacher commented Nov 16, 2022

Attempted to audit all calls to diagnostics.AddError to ensure that the error messages are accurate and follow a consistent formatting scheme, according to https://developer.hashicorp.com/terraform/plugin/log/writing. Standardized on "allowlist" instead of "allow list".

Also cleaned up some obsolete comments and validation checks.

Add a description of the problem this PR addresses and an overview of how this PR works.


This change is Reviewable

Copy link

@ryanluu12345 ryanluu12345 left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @fantapop)

"Could not add network allow list in serverless cluster",
fmt.Sprintf("Network allow list is a feature of dedicated cluster: %s", formatAPIErrorMessage(err)),
"Could not add network allowlist in serverless cluster",
"Network allowlists are only supported with dedicated clusters",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This message makes me worried. Its not obvious how the lack of Serverless config equates to a network allow list error. I'm also worried that whatever holds true now that makes this work may change in the future and there'd be no good way to catch that this is no longer correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the presence of a serverless config, not lack. This is a validation step, and in a future version, this will happen at plan time. That plan-time validation (and corresponding dry run) will happen way before we add these sorts of network tools to serverless clusters.

)
return
} else if cluster.CloudProvider != client.APICLOUDPROVIDER_AWS {
resp.Diagnostics.AddError(
"Incompatible cluster cloud provider",
"Private endpoint services are only available for AWS clusters.",
"Private endpoint services are only available for AWS clusters",
Copy link
Collaborator

Choose a reason for hiding this comment

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

reformat seems fine but I think we should consider updating the language to reflect that this is temporary until its supported on other clouds. For example:
"Private endpoint services are currently only available for AWS clusters"

Doesn't need to be part of this review. @ianjevans

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

Attempted to audit all calls to diagnostics.AddError to ensure that
the error messages are accurate and follow a consistent formatting
scheme, according to https://developer.hashicorp.com/terraform/plugin/log/writing
@fantapop
Copy link
Collaborator

internal/provider/networking_resource.go line 130 at r1 (raw file):

Previously, erademacher (Evan Rademacher) wrote…

It's the presence of a serverless config, not lack. This is a validation step, and in a future version, this will happen at plan time. That plan-time validation (and corresponding dry run) will happen way before we add these sorts of network tools to serverless clusters.

oh I see, this is in the creation of the allow list itself. Makes sense.

Copy link
Collaborator

@fantapop fantapop left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 3 of 5 files reviewed, all discussions resolved (waiting on @ianjevans and @ryanluu12345)

@erademacher
Copy link
Contributor Author

TFTRs!

@erademacher erademacher merged commit 91fddff into main Nov 17, 2022
@erademacher erademacher deleted the error_formatting branch November 17, 2022 00:04
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

4 participants