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

LI-104: Add support for lookup processor #415

Conversation

blemale
Copy link
Contributor

@blemale blemale commented Feb 19, 2020

Support:

  • Lookup processor

@@ -97,6 +98,16 @@ resource "datadog_logs_custom_pipeline" "my_pipeline_test" {
sources = ["ip1"]
}
}
processor {
lookup_processor {
name = "lookup processor"
Copy link
Contributor

Choose a reason for hiding this comment

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

we should start only with required fields

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's the reasoning? Because all the processors around in the test are defined that way.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should make sure that optional fields are really optional. you are right that there is no example for this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still this is a good point, we should create such test. This makes us realize that the same kind of issue may be elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a test with only the mandatory fields.

Copy link
Contributor

@gzussa gzussa left a comment

Choose a reason for hiding this comment

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

Reviewed with @nmuesch, @bkabrda and @zippolyte
Regarding the casting on optional fields there seem to be an issue open as well https://github.com/terraform-providers/terraform-provider-datadog/issues/387
Potentially, we will need to fix this on other resources as well (and add tests without optional fields) but let's make sure it just works well for the scope of this PR. Then we should tackle other processors in a distinct PR.

@@ -97,6 +98,16 @@ resource "datadog_logs_custom_pipeline" "my_pipeline_test" {
sources = ["ip1"]
}
}
processor {
lookup_processor {
name = "lookup processor"
Copy link
Contributor

Choose a reason for hiding this comment

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

Still this is a good point, we should create such test. This makes us realize that the same kind of issue may be elsewhere.

datadog/resource_datadog_logs_custom_pipeline.go Outdated Show resolved Hide resolved
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"default_lookup": {Type: schema.TypeString, Optional: true},
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be marked as required? It looks like trying to create a lookup processor without this value doesn't work.

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 is optional on the API side, what is the error that you get when you try to create a lookup processor without default lookup?

Copy link
Contributor

@bkabrda bkabrda Mar 13, 2020

Choose a reason for hiding this comment

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

I'm getting this:

Error: error updating logs pipeline: (API error 400 Bad Request: {"error":{"code":"InvalidArgument","message":"Invalid Pipeline","details":[{"code":"InvalidArgument","message":"Invalid default lookup: must not be blank"}]}})

@blemale could you please take a look?

@blemale blemale force-pushed the bastien.lemale/LI-104_Add_support_for_lookup_processor branch 4 times, most recently from a89581d to d203877 Compare March 6, 2020 12:09
@blemale blemale force-pushed the bastien.lemale/LI-104_Add_support_for_lookup_processor branch 4 times, most recently from cbc80de to e0e8358 Compare April 28, 2020 14:19
blemale and others added 2 commits April 28, 2020 16:20
The format of the lookup_table field is `["key1,value1", "key2,value2"]`
 and not `["key1", "value1", "key2", "value2"]`
@blemale blemale force-pushed the bastien.lemale/LI-104_Add_support_for_lookup_processor branch from e0e8358 to c2954d4 Compare April 28, 2020 14:20
Add a test with only mandatory fields for lookup processor and make
default_lookup effectively optional.
@blemale blemale force-pushed the bastien.lemale/LI-104_Add_support_for_lookup_processor branch from c2954d4 to 78657a3 Compare April 28, 2020 15:40
@ghost ghost added size/XL and removed size/M labels Apr 28, 2020
@blemale
Copy link
Contributor Author

blemale commented Apr 28, 2020

👋 Hi @gzussa! I have finally found some time to cross the finish line for this PR.
So in 78657a3 I have added a test with only the mandatory fields and I have made default_lookup effectively optional in terraform. Tell me if it is ok for you?

@gzussa gzussa merged commit 60baade into DataDog:master Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants