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

Support multi_compute field in log_query #629

Merged
merged 5 commits into from
Aug 11, 2020
Merged

Conversation

therve
Copy link
Contributor

@therve therve commented Aug 7, 2020

This adds support for the multi_compute field alternative to the
compute one.

Closes #628

This adds support for the `multi_compute` field alternative to the
`compute` one.

Closes #628
@therve therve requested a review from a team as a code owner August 7, 2020 15:16
@therve therve changed the title Pull request for therve/multi-compute Support multi_compute field in log_query Aug 7, 2020
@therve
Copy link
Contributor Author

therve commented Aug 7, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@bkabrda bkabrda left a comment

Choose a reason for hiding this comment

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

Looks mostly good, but I left couple comments inline to address.

@@ -4713,7 +4713,27 @@ func getApmLogNetworkRumSecurityQuerySchema() *schema.Schema {
},
"compute": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since compute and multi_compute are mutually exclusive (as per the docs below), should we mark them with ConflictsWith? (see it's doc under https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/schema#Schema)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, actually after re-reading this I'm not sure. Are they mutually exclusive or can they coexist?

Copy link
Contributor Author

@therve therve Aug 10, 2020

Choose a reason for hiding this comment

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

AFAIK you can't use ConflictsWith inside lists or maps.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that's right. So we're basically relying on the API to return the proper error message if both are used, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I added a TODO below, but I need to change 5 different functions to propagate errors :/

Required: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Copy link
Contributor

Choose a reason for hiding this comment

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

This Schema definition seems the same as the one for multi_compute AFAICS. Would it make sense to create a function to return it instead of duplicating it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could. The schema for compute is actually useless because it's a TypeMap, but it doesn't hurt.

docs/resources/dashboard.md Outdated Show resolved Hide resolved
Copy link
Contributor

@bkabrda bkabrda left a comment

Choose a reason for hiding this comment

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

LGTM now. As for the mutual exclusivity of compute and multi_compute, I think it's ok to rely on API to return a proper error message and not check it in the code for now.

@therve therve merged commit 3c900e2 into master Aug 11, 2020
@therve therve deleted the therve/multi-compute branch August 11, 2020 11:20
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.

[Feature Request] Support multi_compute in query_table_definition
2 participants