-
Notifications
You must be signed in to change notification settings - Fork 389
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
[datadog_logs_custom_pipeline] Add tags and description to logs pipelines #2773
base: master
Are you sure you want to change the base?
Changes from all commits
f82bf57
d24879d
3381a65
9e322e7
6b3b973
3befc5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -417,6 +417,12 @@ func updateLogsCustomPipelineState(d *schema.ResourceData, pipeline *datadogV1.L | |||||
if err := d.Set("is_enabled", pipeline.GetIsEnabled()); err != nil { | ||||||
return diag.FromErr(err) | ||||||
} | ||||||
if err := d.Set("tags", pipeline.GetTags()); err != nil { | ||||||
return diag.FromErr(err) | ||||||
} | ||||||
if err := d.Set("description", pipeline.GetDescription()); err != nil { | ||||||
return diag.FromErr(err) | ||||||
} | ||||||
if err := d.Set("filter", buildTerraformFilter(pipeline.Filter)); err != nil { | ||||||
return diag.FromErr(err) | ||||||
} | ||||||
|
@@ -757,6 +763,13 @@ func buildDatadogPipeline(d *schema.ResourceData) (*datadogV1.LogsPipeline, erro | |||||
var ddPipeline datadogV1.LogsPipeline | ||||||
ddPipeline.SetName(d.Get("name").(string)) | ||||||
ddPipeline.SetIsEnabled(d.Get("is_enabled").(bool)) | ||||||
tagsInterface := d.Get("tags").([]interface{}) | ||||||
tags := make([]string, len(tagsInterface)) | ||||||
for i, v := range tagsInterface { | ||||||
tags[i] = v.(string) | ||||||
} | ||||||
ddPipeline.SetTags(tags) | ||||||
ddPipeline.SetDescription(d.Get("description").(string)) | ||||||
if tfFilter := d.Get("filter").([]interface{}); len(tfFilter) > 0 { | ||||||
filter, ok := tfFilter[0].(map[string]interface{}) | ||||||
if !ok { | ||||||
|
@@ -1205,8 +1218,10 @@ func buildDatadogFilter(tfFilter map[string]interface{}) *datadogV1.LogsFilter { | |||||
|
||||||
func getPipelineSchema(isNested bool) map[string]*schema.Schema { | ||||||
return map[string]*schema.Schema{ | ||||||
"name": {Type: schema.TypeString, Required: true}, | ||||||
"is_enabled": {Type: schema.TypeBool, Optional: true}, | ||||||
"name": {Type: schema.TypeString, Required: true}, | ||||||
"is_enabled": {Type: schema.TypeBool, Optional: true}, | ||||||
"tags": {Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}}, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @skarimo if we use a set isn't it a risk of changing the order of the tags? |
||||||
"description": {Type: schema.TypeString, Optional: true}, | ||||||
"filter": { | ||||||
Type: schema.TypeList, | ||||||
Required: true, | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2022-12-05T10:35:35.260642-05:00 | ||
2025-01-28T17:06:49.90292+01:00 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,180 @@ | ||
--- | ||
version: 2 | ||
interactions: | ||
- request: | ||
body: | | ||
{"filter":{"query":""},"is_enabled":true,"name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1670254535","processors":[{"is_enabled":true,"name":"","sources":["redis.severity"],"type":"status-remapper"},{"categories":[{"filter":{"query":""},"name":"debug"}],"is_enabled":true,"name":"sample category processor","target":"foo.severity","type":"category-processor"},{"filter":{"query":""},"is_enabled":true,"name":"Nginx","type":"pipeline"}]} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines | ||
method: POST | ||
id: 0 | ||
response: | ||
body: | | ||
{"is_enabled":true,"name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1670254535","filter":{"query":""},"is_read_only":false,"type":"pipeline","id":"B5AHvyA3Qm2ABMgMwA0FBw","processors":[{"is_enabled":true,"sources":["redis.severity"],"type":"status-remapper","name":""},{"is_enabled":true,"type":"category-processor","name":"sample category processor","categories":[{"filter":{"query":""},"name":"debug"}],"target":"foo.severity"},{"is_enabled":true,"filter":{"query":""},"type":"pipeline","name":"Nginx","processors":[]}]} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "0ms" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/B5AHvyA3Qm2ABMgMwA0FBw | ||
method: GET | ||
id: 1 | ||
response: | ||
body: | | ||
{"is_enabled":true,"name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1670254535","filter":{"query":""},"is_read_only":false,"type":"pipeline","id":"B5AHvyA3Qm2ABMgMwA0FBw","processors":[{"is_enabled":true,"sources":["redis.severity"],"type":"status-remapper","name":""},{"is_enabled":true,"type":"category-processor","name":"sample category processor","categories":[{"filter":{"query":""},"name":"debug"}],"target":"foo.severity"},{"is_enabled":true,"filter":{"query":""},"type":"pipeline","name":"Nginx","processors":[]}]} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "0ms" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/B5AHvyA3Qm2ABMgMwA0FBw | ||
method: GET | ||
id: 2 | ||
response: | ||
body: | | ||
{"is_enabled":true,"name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1670254535","filter":{"query":""},"is_read_only":false,"type":"pipeline","id":"B5AHvyA3Qm2ABMgMwA0FBw","processors":[{"is_enabled":true,"sources":["redis.severity"],"type":"status-remapper","name":""},{"is_enabled":true,"type":"category-processor","name":"sample category processor","categories":[{"filter":{"query":""},"name":"debug"}],"target":"foo.severity"},{"is_enabled":true,"filter":{"query":""},"type":"pipeline","name":"Nginx","processors":[]}]} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "0ms" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- '*/*' | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/B5AHvyA3Qm2ABMgMwA0FBw | ||
method: DELETE | ||
id: 3 | ||
response: | ||
body: | | ||
{} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: "0ms" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/B5AHvyA3Qm2ABMgMwA0FBw | ||
method: GET | ||
id: 4 | ||
response: | ||
body: | | ||
{"error":{"message":"Non existing pipeline","code":"InvalidArgument"}} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 400 Bad Request | ||
code: 400 | ||
duration: "0ms" | ||
- id: 0 | ||
request: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
content_length: 476 | ||
transfer_encoding: [] | ||
trailer: {} | ||
host: api.datadoghq.com | ||
remote_addr: "" | ||
request_uri: "" | ||
body: | | ||
{"description":"","filter":{"query":""},"is_enabled":true,"name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1738080409","processors":[{"is_enabled":true,"name":"","sources":["redis.severity"],"type":"status-remapper"},{"categories":[{"filter":{"query":""},"name":"debug"}],"is_enabled":true,"name":"sample category processor","target":"foo.severity","type":"category-processor"},{"filter":{"query":""},"is_enabled":true,"name":"Nginx","type":"pipeline"}],"tags":[]} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines | ||
method: POST | ||
response: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
transfer_encoding: | ||
- chunked | ||
trailer: {} | ||
content_length: -1 | ||
uncompressed: true | ||
body: | | ||
{"id":"MsnpTFYQQHGlqMjKsWlPBQ","type":"pipeline","name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1738080409","is_enabled":true,"is_read_only":false,"filter":{"query":""},"processors":[{"name":"","is_enabled":true,"sources":["redis.severity"],"type":"status-remapper"},{"name":"sample category processor","is_enabled":true,"categories":[{"filter":{"query":""},"name":"debug"}],"target":"foo.severity","type":"category-processor"},{"type":"pipeline","name":"Nginx","is_enabled":true,"filter":{"query":""},"processors":[]}],"tags":[],"description":""} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: 412.800792ms | ||
- id: 1 | ||
request: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
content_length: 0 | ||
transfer_encoding: [] | ||
trailer: {} | ||
host: api.datadoghq.com | ||
remote_addr: "" | ||
request_uri: "" | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/MsnpTFYQQHGlqMjKsWlPBQ | ||
method: GET | ||
response: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
transfer_encoding: | ||
- chunked | ||
trailer: {} | ||
content_length: -1 | ||
uncompressed: true | ||
body: | | ||
{"id":"MsnpTFYQQHGlqMjKsWlPBQ","type":"pipeline","name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1738080409","is_enabled":true,"is_read_only":false,"filter":{"query":""},"processors":[{"name":"","is_enabled":true,"sources":["redis.severity"],"type":"status-remapper"},{"name":"sample category processor","is_enabled":true,"categories":[{"filter":{"query":""},"name":"debug"}],"target":"foo.severity","type":"category-processor"},{"type":"pipeline","name":"Nginx","is_enabled":true,"filter":{"query":""},"processors":[]}],"tags":[],"description":""} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: 150.6ms | ||
- id: 2 | ||
request: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
content_length: 0 | ||
transfer_encoding: [] | ||
trailer: {} | ||
host: api.datadoghq.com | ||
remote_addr: "" | ||
request_uri: "" | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/MsnpTFYQQHGlqMjKsWlPBQ | ||
method: GET | ||
response: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
transfer_encoding: | ||
- chunked | ||
trailer: {} | ||
content_length: -1 | ||
uncompressed: true | ||
body: | | ||
{"id":"MsnpTFYQQHGlqMjKsWlPBQ","type":"pipeline","name":"tf-TestAccDatadogLogsPipelineEmptyFilterQuery-local-1738080409","is_enabled":true,"is_read_only":false,"filter":{"query":""},"processors":[{"name":"","is_enabled":true,"sources":["redis.severity"],"type":"status-remapper"},{"name":"sample category processor","is_enabled":true,"categories":[{"filter":{"query":""},"name":"debug"}],"target":"foo.severity","type":"category-processor"},{"type":"pipeline","name":"Nginx","is_enabled":true,"filter":{"query":""},"processors":[]}],"tags":[],"description":""} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: 146.403208ms | ||
- id: 3 | ||
request: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
content_length: 0 | ||
transfer_encoding: [] | ||
trailer: {} | ||
host: api.datadoghq.com | ||
remote_addr: "" | ||
request_uri: "" | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- '*/*' | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/MsnpTFYQQHGlqMjKsWlPBQ | ||
method: DELETE | ||
response: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
transfer_encoding: [] | ||
trailer: {} | ||
content_length: 3 | ||
uncompressed: false | ||
body: | | ||
{} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
code: 200 | ||
duration: 161.173ms | ||
- id: 4 | ||
request: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
content_length: 0 | ||
transfer_encoding: [] | ||
trailer: {} | ||
host: api.datadoghq.com | ||
remote_addr: "" | ||
request_uri: "" | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
url: https://api.datadoghq.com/api/v1/logs/config/pipelines/MsnpTFYQQHGlqMjKsWlPBQ | ||
method: GET | ||
response: | ||
proto: HTTP/1.1 | ||
proto_major: 1 | ||
proto_minor: 1 | ||
transfer_encoding: | ||
- chunked | ||
trailer: {} | ||
content_length: -1 | ||
uncompressed: true | ||
body: | | ||
{"error":{"code":"InvalidArgument","message":"Non existing pipeline"}} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 400 Bad Request | ||
code: 400 | ||
duration: 136.473958ms |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2023-03-06T13:31:10.412492-05:00 | ||
2025-01-27T19:12:45.636115+01:00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.